diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index dcf4a22fdf3bc10cc5136615e017c26b997e9b64..c298e37672a886c9650b60e0aecd343c2958c394 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,23 +1,23 @@ -Cover Charge v0.3.12.189: 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.189. +Cover Charge v0.3.12.190: 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.190. SHA-256 of each web app's start page, service worker, manifest and logo: -814b46ed234f9fbb168a58d4ef99fbd26f7c9a75dbba4c13c09859e2194b47e4 owner-app/index.html -3340023c8d99dd7e305fd3cb68023e65aa07ecfd32f9e3dbb210f20096e77d1e owner-app/sw.js +9dde41386122da8a3b03ebd44b9d8e11a73b4149f04a7fd03578557236ab6caf owner-app/index.html +d6858eb32e96e859f64788e729375053bb92f73b47cf1e9e922c3a5d661ff69e owner-app/sw.js e305c44d11a9c25f37372f3fa4d329d4ffb04df2edee6e7b4b9ac91f3875ac67 owner-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 owner-app/brand-logo.png -9943dfaf05adc30bb8befea0e9e604a21a13b45ce7bf363c1daac2b31ff92d14 staff-app/index.html -92b79a29fb2a6282b93f81a2e2135bdfca9e09ce61a3d09f4e01175d81d5416b staff-app/sw.js +626b00bf28d9a6fdac1a636610605fc48d29550cffe04da6f075a58aa81519e4 staff-app/index.html +94fb45286bad854ca69970f1397656f7d518727c6dc610c4592d0fd3eb579476 staff-app/sw.js bd1d310ebf8e2a80808e100c41fb7fe1c4369d3026478f3ad8eececaeadaf4ac staff-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 staff-app/brand-logo.png -5f5a0b311bcf2878bf0c2561377a7ee9d3721151bd37a990f792201310f25603 customer-app/index.html -d0e491615ff0d12f694726ec4ca0fc8b459fdbc751141013cc6beb98fb372715 customer-app/sw.js +18fce341786f531b9b5b440f59d5d104c82d904d5b2197887840e7f83903b034 customer-app/index.html +281ef954b181393401a404ab8242d8305e821791a6e0752ea35707bbb4b535eb customer-app/sw.js 3bfb1fd10cc13f09ca6be65c461e1f6b5750ae51a3ece12e079750b2a066052e customer-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 customer-app/brand-logo.png -ea79ac27b5895148f7ab7c4f356765b19783b6e52cae28373b1c1c484b6fc1cf display-app/index.html -9d5e9b7bad168f98499bfd8639dae60b0e031e01988ebc9873ac4844db618e7b display-app/sw.js +49cb1bd0edb18aeebf53dae24025aae7372f01a024f9accf56bc1609704c1bf5 display-app/index.html +c8a71ac0e537419506a05704f644e61ce81cc181aeb1c55534c3c9105a4264f6 display-app/sw.js 35e2721b86eb1ae1605e55bee64177adcee72f4e53a24ac417d19ea2873434a1 display-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 display-app/brand-logo.png -289aadbc405947cd5d91abcbb0bc52aa3ac0c624a904372835e9adc18632fdee chef-app/index.html -1954b7ab6fc2df06c0b8ef6cda2678b21136d7d76f4cf63a30aa96b6ed3710ae chef-app/sw.js +a33527a3ac71e32e4b1fee508bddf853e8f9dd577d97f5f680ca7e5c6950a31e chef-app/index.html +ad6b6aa0b51b846fd3a7fc5c61a943ee060a6f93a2191aff7019dc907bf806f2 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 241a4f0240ee0b7ed8b2217d405e25c1ec84b428..366820a1fada1e6b77858d764117d3224d85b121 100644 --- a/car-app/_expo/static/js/web/bundle.js +++ b/car-app/_expo/static/js/web/bundle.js @@ -5,7 +5,7 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() !(function(r){let l=0,n=!0===r.RN$useAlwaysAvailableJSErrorHandling?r.RN$handleException:(r,l)=>{throw r};const t={setGlobalHandler(r){n=r},getGlobalHandler:()=>n,reportError(r){n&&n(r,!1)},reportFatalError(r){n&&n(r,!0)},applyWithGuard(r,n,e,a,o){try{return l++,r.apply(n,e)}catch(r){t.reportError(r)}finally{l--}return null},applyWithGuardIfNeeded:(r,l,n)=>t.inGuard()?r.apply(l,n):(t.applyWithGuard(r,l,n),null),inGuard:()=>!!l,guard(r,l,n){if('function'!=typeof r)return console.warn('A function must be passed to ErrorUtils.guard, got ',r),null;const e=l??r.name??'';return function(...l){return t.applyWithGuard(r,n??this,l,null,e)}}};r.ErrorUtils=t})('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof global?global:'undefined'!=typeof window?window:this); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,20]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&!t.PITCH_ANCHORAGE&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=o=>{if(3===o.nodeType){const e=o.nodeValue??'',a=(0,n.pitchText)(e,t.PITCH_ANCHORAGE);return void(a!==e&&(o.nodeValue=a))}if(1!==o.nodeType)return;const a=o;if('INPUT'===a.tagName||'TEXTAREA'===a.tagName){const e=a,o=(0,n.pitchText)(e.value,t.PITCH_ANCHORAGE);o!==e.value&&(e.value=o);const i=e.getAttribute('placeholder');if(i){const o=(0,n.pitchText)(i,t.PITCH_ANCHORAGE);o!==i&&e.setAttribute('placeholder',o)}}for(const e of['aria-label','title']){const o=a.getAttribute(e);if(o){const i=(0,n.pitchText)(o,t.PITCH_ANCHORAGE);i!==o&&a.setAttribute(e,i)}}a.childNodes.forEach(e)},o=()=>{e(document.body),document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE),new MutationObserver(o=>{for(const t of o)'characterData'===t.type?e(t.target):t.addedNodes.forEach(e),'attributes'===t.type&&e(t.target);document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?o():document.addEventListener('DOMContentLoaded',o)}}},1,[2,3,16,18,19]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!0},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!1},2,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return c.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return R}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]);const u={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[6]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},h={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},f={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},b={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},p=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:f,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...u,orderAtTable:!1,pay:h,cashUpRecord:[...l.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:8,bookingNoticeMins:15,autoAcceptUpTo:8},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...u,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],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']},settings:{...u,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],A={by:'Fictional demo',at:'2026-10-26'},T=(t,n,o,s,c,l,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:c,price:l,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:A}),R=[T('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),T('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),T('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),T('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),T('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),T('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),T('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),T('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),T('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),T('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13,15]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="anchorage".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); @@ -1070,7 +1070,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()})},987,[35,988]); __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},988,[985,948,989]); __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'}},989,[985]); -__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.189'},990,[]); +__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.190'},990,[]); __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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},991,[992,993,904,948,988]); __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())}}}},993,[948]); @@ -1244,7 +1244,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 e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1161,[35,403,103,795,868,822,1154,1153,1158,1011,26]); __d(function(g,_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.ChefForecast=function({openPrep:e}){const{r:f,rid:y,now:b}=(0,u.useChef)(6e4),x=(0,l.useBookings)(y),p=(0,l.useOrders)(y),j=(0,l.useEvents)(y),k=(0,a.useRealHistory)(y,b),w=(0,d.ymd)(b),[T,$]=(0,o.useState)(7),{covers:v,enough:C,booked:D,pct:I,day:A,example:L}=(0,u.useForecast)(),M=0===I?`about a usual ${A}`:`${Math.abs(I)}% ${I>0?'busier':'quieter'} than a usual ${A}`,z=(0,o.useMemo)(()=>Array.from({length:T},(e,o)=>{const s=0===o?b:(0,d.addMins)((0,d.parseYmd)(w),1440*o),t=(0,i.forecastToday)(f,x,p,j,s,k??void 0);return{d:s,f:t,booked:t.hours.reduce((e,o)=>e+o.booked,0),covers:t.hours.reduce((e,o)=>e+o.covers,0)}}),[f,x,p,j,w,T,k,b.getTime()/6e5|0]),B=z[0].f,R=z.map(e=>({key:(0,d.ymd)(e.d),label:(0,d.dayShort)(e.d),spoken:(0,d.dayLong)(e.d),value:e.f.open?C?e.covers:e.booked:0,open:!!e.f.open}));return(0,h.jsxs)(t.default,{style:{gap:12},testID:"chef-forecast",children:[(0,h.jsx)(r.Muted,{center:!0,testID:"chef-forecast-busy",children:B.busy.words}),C?null:(0,h.jsx)(a.NotEnoughHistory,{weeks:B.minWeeks,booked:D}),(0,h.jsxs)(r.Card,{children:[(0,h.jsxs)(t.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,h.jsxs)(r.T,{center:!0,weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:[7===T?'This week':`Next ${T} days`," \xb7 ",C?'forecast covers':'booked covers']}),C?B.example?(0,h.jsx)(a.ExampleBadge,{}):(0,h.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"}):null]}),(0,h.jsx)(r.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,h.jsx)(r.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:T===e,onPress:()=>$(e),testID:`chef-forecast-range-${e}`},e))}),(0,h.jsx)(c.DaysLineGraph,{days:R,titleSpoken:`${C?'Forecast':'Booked'} covers for the next ${T} days`})]}),(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:"Covers per day"}),(0,h.jsxs)(t.default,{testID:"chef-forecast-days",children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',paddingVertical:6,borderBottomWidth:1,borderColor:n.colours.hairline},children:[(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{flex:1,textAlign:'left'},children:"Day"}),(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:72,textAlign:'right'},children:"Booked"}),C?(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:84,textAlign:'right'},children:"Forecast"}):null]}),z.map((e,o)=>{const s=0===o;return(0,h.jsxs)(t.default,{testID:`chef-forecast-day-${(0,d.ymd)(e.d)}`,accessible:!0,accessibilityLabel:e.f.open?`${(0,d.dayLong)(e.d)}: ${e.booked} booked${C?`, about ${e.covers} forecast`:''}`:`${(0,d.dayLong)(e.d)}: closed`,style:{flexDirection:'row',alignItems:'center',minHeight:40,borderBottomWidth:o({minHeight:48,borderRadius:12,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:e?n.colours.goldTint:'transparent'}),children:(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,children:"Open prep list \u203a"})})]})]})};var o=_r(_d[0]),s=e(_r(_d[1])),t=e(_r(_d[2])),r=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),d=_r(_d[6]),n=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11])},1162,[35,403,103,795,875,1155,859,822,1163,1159,1158,26]); __d(function(g,_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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1163,[829,35,284,365,237,103,427,798,795,828,822,1164,26]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,l=u,f=Math.max(10,i-s-l),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let M=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(p=n.busiest.t,s+(p-n.t0)/x*f-o/2);M={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var p;return{hours:b,busiest:M}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xf+(t-c)/M*b,w=l.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:p(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',f=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=l.indexOf(n);return t+(o<0?1e3:f[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.peakOccupancyText=function(t,n){const o=String(new Date(t).getHours()).padStart(2,'0');return`Peak ${n} ${1===n?'cover':'covers'} at ${o}:00`},e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,f=u,l=Math.max(10,i-s-f),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let p=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(M=n.busiest.t,s+(M-n.t0)/x*l-o/2);p={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var M;return{hours:b,busiest:p}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xl+(t-c)/p*b,w=f.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:M(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',l=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=f.indexOf(n);return t+(o<0?1e3:l[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); __d(function(g,_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.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,I.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,I.useForecast)(),f=(0,k.ymd)(i),p=(0,R.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),m=p.reduce((e,t)=>e+t.sold,0)||1,x=p.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/m)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),b={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{b[e.ing]=(b[e.ing]??0)+e.qty*t.qty}));const y=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini-fish-goujons','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,$.fmtQty)(Math.ceil(2*(b.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,$.fmtQty)(Math.ceil(10*(b.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,$.fmtQty)(Math.ceil(10*(b.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,$.fmtQty)(Math.ceil(2*(b.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,D.useKitchen)(e=>e.tickPrep),w=[...y.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=w.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,q.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,q.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} Covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,q.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} Covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," Covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,q.jsx)(u.Badge,{kind:S===w.length?'ok':'gold',label:`${S}/${w.length} done`})]}),w.map((t,i)=>{const n=e.prepTicks[t.key];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?C.colours.ok:C.colours.border,backgroundColor:C.colours.surface,marginTop:i===y.length?8:0},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:C.colours.muted}:void 0,children:t.text}),n?(0,q.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,q.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,I.useChef)(),a=(0,I.useWeek)(),d=(0,D.useKitchen)(e=>e.addWaste),[f,p]=(0,o.useState)(e.ingredients[0]?.id),[m,x]=(0,o.useState)(''),[b,y]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),k=Number(m.replace(',','.'))||0,S=k>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*k)),T=w&&S?(0,s.inputQuantity)(l,w,k):0,v=e.waste.filter(e=>(0,I.within7)(e.at,r));return w?(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,q.jsx)(I.Tile,{label:"Waste this week",value:(0,j.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,q.jsx)(I.Tile,{label:"Waste as % of food sales",value:a.sales?(0,I.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,q.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,q.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,q.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>p(e.id)},e.id))})}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:m,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:C.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),(0,q.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,q.jsx)(u.T,{weight:"semibold",colour:C.colours.gold,children:(0,j.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,q.jsxs)(u.Row,{children:[(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(k)-.5)))}),(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(k)+.5))}),(0,q.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:D.WASTE_REASONS.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===b,onPress:()=>y(e)},e))}),(0,q.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:b,cost:Math.round(T*w.cost)}),x('')}}),(0,q.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,q.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,q.jsx)(u.T,{size:14,children:(0,j.gbp)(e.cost)})]},e.id))]}):(0,q.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,I.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,b.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'},c=(0,m.useUnsignedDishes)(i),[x,j]=(0,o.useState)(!1);return x?(0,q.jsx)(m.UnsignedDishList,{rid:i,actor:a,onClose:()=>j(!1),onOpenCards:e}):(0,q.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,q.jsx)(d.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>j(!0),style:({pressed:e})=>({minHeight:48,opacity:e?.85:1}),children:(0,q.jsxs)(u.Card,{style:{alignItems:'center'},highlight:c.length?C.colours.amber:void 0,children:[(0,q.jsx)(u.Muted,{center:!0,children:"Dishes not signed off"}),(0,q.jsx)(u.T,{center:!0,size:20,weight:"bold",children:c.length})]})}),(0,q.jsx)(u.Muted,{children:"The 14 allergens from each recipe card. These are what guests see on the menu, takeaway and the booking allergy check. A red warning means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,q.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,l.map(({card:e,fromCosting:t})=>(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",center:!0,children:e.dish}),(0,q.jsx)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i,r='contains'===i?'Contains':'may'===i?'May contain':n?'In costing recipe, not on card':'Not listed';return(0,q.jsxs)(h.default,{accessible:!0,accessibilityLabel:`${e.dish}, ${s.label}: ${r}`,style:{flexGrow:1,flexBasis:220,minWidth:180,maxWidth:'100%',padding:8,borderRadius:8,backgroundColor:n?C.colours.redBg:C.colours.surface2},children:[(0,q.jsx)(u.T,{center:!0,size:14,weight:"semibold",children:s.label}),(0,q.jsx)(u.T,{center:!0,size:14,colour:n?C.colours.red:'contains'===i?C.colours.gold:C.colours.muted,children:r})]},s.id)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Not listed means the allergen is not recorded on this recipe card. Check any costing warnings before sign-off."}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,q.jsxs)(u.Card,{highlight:s.length?C.colours.red:C.colours.amber,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,q.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,q.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,q.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,p.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,q.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,q.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,I.useChef)(),l=(0,k.ymd)(i),a=(0,D.useKitchen)(e=>e.addTemp),c=(0,x.useOwner)(e=>e.checks),{tick:f,untick:p}=x.useOwner.getState(),[m,b]=(0,o.useState)('fridge'),y=E.find(e=>e.id===m),j={...y,units:y.units.filter(e=>(0,n.chefCanSee)(r,e))},[w,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,M=e.temps.filter(e=>e.at.slice(0,10)===l),B=(e,t,i)=>{const n=c[e];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?p(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,children:t}),(0,q.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:E.map(e=>(0,q.jsx)(u.Chip,{label:e.label,selected:e.id===m,onPress:()=>{b(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===w,onPress:()=>S(e)},e))}),(0,q.jsx)(u.Muted,{children:j.rule}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:C.colours.muted,style:{width:90,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),null===$?null:(0,q.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,q.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:m,unit:w,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,q.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",M.length,")"]}),M.length?M.map(e=>{const t=E.find(t=>t.id===e.kind)?.ok(e.temp);return(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,q.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,q.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?C.colours.ok:'warn'===t?C.colours.amber:C.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,q.jsx)(u.Muted,{children:"None yet today."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,q.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),G.map(e=>B(`${l}:kc-${e.id}`,e.text))]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),F.map(e=>B('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,I.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,v.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??I.CHEF_ID,role:'staff'}),[d?.id]),u=(0,T.useChatOpen)(e=>e.ch);return(0,o.useEffect)(()=>{u&&a('chat')},[u]),(0,q.jsx)(S.ChatAsCtx.Provider,{value:c,children:(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(H,{sub:r,setSub:a}),'live'===r?(0,q.jsx)(_,{}):'soldout'===r?(0,q.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,q.jsx)(V,{}):(0,q.jsx)(U,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),D=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),z=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]),N=_r(_d[36]),W=_r(_d[37]),q=_r(_d[38]);const E=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],F=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],G=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function H({sub:e,setSub:t}){const{total:s}=(0,S.useChatUnread)();return(0,q.jsx)(I.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function U(){return(0,q.jsx)(S.Chat,{go:()=>{}})}function _(){const{rid:e,r:t,me:s,now:i}=(0,I.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))),c=(e,t)=>!!(0,B.statusBlock)(e,t,(0,B.linkedBooking)(e,n)),p=(0,b.ticketView)('chef',d),m=(0,f.useStore)(e=>e.setOrderStatus),x=(0,f.useStore)(e=>e.ackReadiness),j=d.flatMap(e=>(0,w.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,q.jsxs)(h.default,{style:{gap:8},children:[j.length?(0,q.jsx)(u.Banner,{kind:"warn",title:`${j.length} readiness alert${j.length>1?'s':''}`,children:j.map(e=>e.detail).join(' \xb7 ')}):(0,q.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,q.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,p.length?p.map(e=>(0,q.jsxs)(u.Card,{highlight:e.allergies.length&&(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))&&'ready'!==e.status?C.colours.red:void 0,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`Table ${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,q.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,q.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,q.jsxs)(u.T,{size:13,colour:C.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,q.jsx)(M.AllergyChain,{o:e,me:s}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{m(e.id,'preparing',s),'takeaway'===e.type&&x(e.id,'cook',s)}}):null,'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>m(e.id,'ready',s)}):null]})]},e.id)):(0,q.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const K=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,k.ymd)(new Date(s,i-1,n+t))};function V(){const{now:e,today:t}={...(0,I.useChef)(6e4),today:(0,k.ymd)(new Date)},{staff:s,shifts:i}=(0,b.rotaView)('chef',(0,x.useOwner)(e=>e.staff),(0,x.useOwner)(e=>e.shifts)),n=(0,x.useOwner)(e=>e.leave),r=(0,N.canEditKitchenRota)((0,P.useSync)(e=>e.perms)),l=(0,x.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),a=(0,v.weekday)(e),o=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),d=(0,z.useSession)(e=>e.meId),c=(0,P.useSync)(e=>e.staffRef),f=d??c??I.CHEF_ID,p=(0,x.useOwner)(e=>e.staff.find(e=>e.id===f)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(L.BreakRoomCard,{staffId:f,name:p,now:e}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"On now"}),l.length?l.map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,q.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,q.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",v.DAY3[a],")"]}),i.filter(e=>e.date===t).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,W.leaveCovering)(n,e.staffId,e.date)?(0,q.jsx)(u.T,{size:13,colour:C.colours.blue,children:(0,W.leaveLabel)((0,W.leaveCovering)(n,e.staffId,e.date))}):(0,q.jsxs)(u.Muted,{children:[(0,v.fmtH)(e.start),"\u2013",(0,v.fmtH)(e.end)]})]},e.id))]}),r?(0,q.jsx)(u.Card,{children:(0,q.jsx)(A.KitchenRotaEditor,{today:t})}):(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),o.map(e=>(0,q.jsxs)(h.default,{style:{gap:4},children:[(0,q.jsx)(u.T,{size:14,children:e.name}),(0,q.jsx)(u.Row,{wrap:!0,gap:4,children:v.DAY3.map((s,n)=>{const r=i.find(s=>s.staffId===e.id&&s.date===K(t,n-a));return(0,q.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:r?C.colours.goldTint:C.colours.surface2,alignItems:'center'},children:[(0,q.jsx)(u.T,{size:10,colour:C.colours.muted,children:s}),(0,q.jsx)(u.T,{size:10,children:r?`${(0,v.fmtH)(r.start).slice(0,2)}\u2013${(0,v.fmtH)(r.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})]})}},1165,[828,955,1166,836,861,1167,1168,35,403,296,103,795,875,883,1169,892,966,862,868,1172,859,822,1173,1099,1073,1154,1153,1174,870,1158,1011,896,1175,977,958,1178,961,1087,26]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1166,[1153,955]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1167,[828,35,103,795,875,950,892,951,952,953,832,822,26]); @@ -1261,7 +1261,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";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=w,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,l.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,y.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,y.jsx)(w,{today:e}):(0,y.jsx)(I,{today:e})})},_e.KitchenRotaRead=I;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],j=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,k=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,p=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function w({today:e=(0,h.ymd)(new Date)}){const r=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,l.kitchenTeam)(r),[r]),$=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[w,I]=(0,t.useState)(0),S=(0,f.useDateCalendar)(),[v,C]=(0,t.useState)(null),[T,H]=(0,t.useState)(''),P=(0,a.addDays)((0,a.mondayOfDate)(e),7*w),L=(0,a.addDays)(P,6),R=b.map((e,t)=>(0,a.addDays)(P,t)),M=(0,l.kitchenPending)(o,$,P,L).length,O=e=>{H(e),(0,u.announce)(e)},W=0===w?'This week':1===w?'Next week':-1===w?'Last week':`Week of ${k(P)}`;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center',flexWrap:'nowrap'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(w-1),H('')},style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${W}, ${x[0]} ${k(P)} to ${x[6]} ${k(L)}`,style:{alignItems:'center',minWidth:120,flex:1},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:W}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(P)," \u2013 ",j(L)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(w+1),H('')},style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:S.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:S.calOpen,today:e,day:P,showBusy:!0,idPrefix:"krota-cal",onClose:S.closeCal,onDay:t=>{I((0,f.weekOffsetOf)(t??e,e)),H('')}}),d.map(t=>(0,y.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[p(t.nickname||t.name),t.job?(0,y.jsx)(n.T,{size:12,colour:m.colours.muted,children:` ${t.job}`}):null]}),(0,y.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:R.map((i,a)=>{const l=o.find(e=>e.staffId===t.id&&e.date===i),r=!(!l||l.published&&!l.changed),d=`${p(t.nickname||t.name)}, ${x[a]} ${k(i)}, ${l?`${(0,c.fmtH)(l.start)} to ${(0,c.fmtH)(l.end)}${r?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,y.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>C({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:r?'dashed':'solid',borderColor:l?r?m.colours.amber:m.colours.gold:m.colours.border,backgroundColor:e||l?m.colours.goldTint:m.colours.surface2}),children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:i===e?m.colours.gold:m.colours.muted,children:b[a]}),(0,y.jsx)(n.T,{size:10,center:!0,children:l?`${(0,c.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(l.end).slice(0,5)}):(0,y.jsx)(n.T,{size:10,center:!0,colour:m.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,y.jsx)(n.Button,{testID:"krota-publish",kind:M?'primary':'secondary',disabled:!M,label:M?`Publish kitchen rota (${M} ${1===M?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:M?`Publish the kitchen rota for ${W.toLowerCase()}, ${M} ${1===M?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,$,P,L);a.useOwner.getState().setShifts(e.shifts),O(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,y.jsx)(i.default,{testID:"krota-msg",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.goldLight,children:T})}):null,(0,y.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),v?(0,y.jsx)(D,{init:v,onClose:()=>C(null),onSaid:O}):null]})}function I({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:l}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,$]=(0,t.useState)(0),w=(0,f.useDateCalendar)(),I=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),D=(0,a.addDays)(I,6),S=b.map((e,t)=>(0,a.addDays)(I,t)),v=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),C=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${k(I)}`,[T,H]=(0,t.useState)(0),P=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>H(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>$(u-1),style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${C}, ${x[0]} ${k(I)} to ${x[6]} ${k(D)}`,style:{alignItems:'center',minWidth:120},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:C}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(I)," \u2013 ",j(D)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>$(u+1),style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:w.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:w.calOpen,today:e,day:I,showBusy:!0,idPrefix:"krota-read-cal",onClose:w.closeCal,onDay:t=>$((0,f.weekOffsetOf)(t??e,e))}),v.map(t=>(0,y.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:p(t.nickname||t.name)}),(0,y.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=l.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,r.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,r.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,y.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${p(t.nickname||t.name)}, ${x[a]} ${k(s)}, ${u}`,style:{width:P,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.goldTint:m.colours.surface2},children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:s===e?m.colours.gold:m.colours.muted,children:b[a]}),o&&h?(0,y.jsx)(n.T,{size:9,center:!0,colour:m.colours.blue,children:(0,r.leaveLabel)(h).toLowerCase()}):(0,y.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),v.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,y.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function D({init:e,onClose:s,onSaid:r}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=p(o?.nickname||o?.name||''),[u,f]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[j,w]=(0,t.useState)(!1),[I,D]=(0,t.useState)(''),S=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${k(e.date)})`;return(0,y.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${S}`,testID:"krota-sheet",children:(0,y.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,y.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{f(t),x(s)}},e))}),(0,y.jsx)(n.T,{center:!0,children:"Start"}),(0,y.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:f,format:c.fmtH,label:"Start time"}),(0,y.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,y.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,y.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),I?(0,y.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.amber,children:I})}):null,(0,y.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?D(`${d} already has a shift that overlaps on ${S}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),r(`${e.shift?'Changed':'Added'}: ${d}, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!j?(0,y.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&j?(0,y.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",S,"?"]}),(0,y.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),r(`Removed ${d}'s shift on ${S}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,y.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1178,[35,403,103,795,892,961,1087,966,958,1076,859,1111,1067,822,26]); __d(function(g,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.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1179,[1166,955,35,380,103,795,892,966,868,822,1073,1158,1011,1180,26]); __d(function(g,_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.openLink=w,_e.useSheetReminders=C,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=C(),f=(0,b.wd)(l);return(0,j.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,j.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,j.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,j.jsx)($,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,j.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]);function w(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function k(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const S={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},T={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function C(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function $({s:e,open:n,onToggle:o}){const{rid:C,r:$,me:D,now:I}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),M=(0,u.useOrderSheets)(e=>e.markOpened),B=(0,u.useOrderSheets)(t=>t.opened[e.id]),[L,P]=(0,s.useState)({}),[O,R]=(0,s.useState)(''),[A,z]=(0,s.useState)(''),[_,W]=(0,s.useState)(!1),H=(0,h.useShellfish)(C,D,'chef'),K=(0,b.nextDelivery)(e,I),E=(0,b.orderLines)(e,L,O,C),N=($.address??$.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=N.length>=3?N[1]:N[0]??'',U=(0,b.orderMessage)(e,$.name,q,E,D.split(' ')[0],I),Q=e.orderDays.includes((0,b.wd)(I)),Y=(e,t)=>P(n=>({...n,[e.id]:(0,l.stepQuantity)(C,e,n[e.id]||0,t)})),F=t=>{M(e.id,I.toISOString()),w(t)},G='text'===e.method||'whatsapp'===e.method||'phone'===e.method,V=Math.round(100*((0,y.parseMoneyInput)(A)??NaN)),J=H.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),X=J.filter(e=>H.isLow(e.key));return(0,j.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:Q||X.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,j.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[S[e.method]," ",e.name]}),(0,j.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,j.jsx)(i.Muted,{children:e.goods}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,j.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,j.jsx)(i.Badge,{kind:Q?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,j.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,j.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,J.length?(0,j.jsx)(i.Badge,{kind:X.length?'amber':'ok',label:J.map(e=>`${e.icon} ${(0,c.fmtStockCount)(C,e,H.counts[e.key]??0)}`).join(' \xb7 ')}):null,B&&new Date(B).toDateString()===I.toDateString()?(0,j.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,j.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[K?(0,j.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(K),"."]}):null,e.reminder?(0,j.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,j.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,j.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,j.jsxs)(d.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{children:[e.name,e.unit?(0,j.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(C,e),")"]}):null]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Y(e,-1),style:{minWidth:44,minHeight:44}}),(0,j.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(C,e,L[e.id]||0),children:(0,j.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(C,e)?(0,l.fishQtyText)(C,e,L[e.id]||0):L[e.id]||0})}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Y(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,j.jsx)(t.TextInput,{value:O,onChangeText:R,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[T,{minHeight:60}]})]}),G?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(C,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,'online'===e.method?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(C,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,e.priceCapPerKg?(0,j.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,j.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,j.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,j.jsx)(t.TextInput,{testID:"price-found",value:A,onChangeText:e=>z((0,y.sanitiseMoneyTyping)(e)),keyboardType:"decimal-pad",inputMode:"decimal",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[T,{width:120}]})]}),V>0?(0,j.jsx)(i.Badge,{kind:V<=e.priceCapPerKg?'ok':'red',label:V<=e.priceCapPerKg?`${(0,p.gbp)(V)}/kg is under the cap \u2713`:`${(0,p.gbp)(V)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,j.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,j.jsx)(i.T,{size:f.font.small,children:E.length?U:'Add quantities above to write the order.'})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!E.length,onPress:()=>F((0,b.smsLink)(e.number,U))}):null,'whatsapp'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!E.length,onPress:()=>F((0,b.waLink)(e.number,U))}):null,'phone'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>F((0,b.telLink)(e.number))}):null,'online'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>F(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&E.length?(0,j.jsx)(i.Button,{kind:"ghost",label:_?'Copied \u2713':'Copy order',onPress:async()=>{const e=await k(U);W(e),e&&setTimeout(()=>W(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,j.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,j.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1180,[828,836,955,35,380,237,403,103,795,1009,954,956,868,1010,822,1158,14,26]); -__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); +__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',justifyContent:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},1182,[5,823,824,829,237,827]); __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,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',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,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',w:64,h:45}}},1183,[]); __d(function(g,_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(', '))})]})}},1184,[828,1009,1166,955,35,403,103,795,892,868,822,1158,1011,14,26]); @@ -1301,7 +1301,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.AssignRoleSheet=function({name:e,when:s,current:u,onSave:b,onEditTimes:y,onClose:j}){const x={minHeight:o.IS_CAR?64:56,width:'100%'},_=(0,l.cleanBadge)(u);return(0,c.jsxs)(n.Sheet,{visible:!0,onClose:j,title:"Assign a role?",testID:"assign-role-sheet",maxWidth:560,children:[(0,c.jsx)(n.T,{size:18,center:!0,weight:"semibold",children:e}),(0,c.jsx)(n.Muted,{center:!0,children:s}),(0,c.jsxs)(t.default,{style:{gap:8,width:'100%'},children:[l.ROLE_BADGES.map(e=>(0,c.jsx)(n.Button,{kind:_===e?'primary':'secondary',label:e,testID:`assign-role-${h(e)}`,accessibilityLabel:`${e}${_===e?', chosen':''}`,onPress:()=>b(e),style:x},e)),(0,c.jsx)(n.Button,{kind:_?'secondary':'primary',label:"None",testID:"assign-role-none",accessibilityLabel:_?'None, clear the role badge':'None, chosen',onPress:()=>b(void 0),style:x}),y?(0,c.jsx)(n.Button,{kind:"ghost",label:"Edit shift times",testID:"assign-role-edit-times",onPress:y,style:x}):null]})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),o=r(d[4]),c=r(d[5]);const h=e=>e.replace(/\s+/g,'-').toLowerCase()},1218,[35,103,795,1217,873,26]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1219,[35,103,795,892,822,1073,1076,1215,1087,26]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1220,[35,103,1073,822,795,26]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),f=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),u=(0,n.useOwner)(e=>e.staff),x=(0,o.workingNow)(f,u,t),w=(0,o.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:r.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:r.colours.muted,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:r.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:r.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:r.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:r.colours.muted,center:!0,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:r.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:r.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),h=_r(d[7])},1221,[35,103,1073,892,1222,822,795,26]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:t=!1,marquee:s=!1}={}){const{today:u}=(0,o.useCtx)(15e3),p=(0,l.useOwner)(e=>(0,l.liveAttendance)(e.attendance)),j=(0,l.useOwner)(e=>e.staff),I=(0,r.workingNow)(p,j,u),D=(0,r.cardSpeech)(I),[k,v]=(0,e.useState)(0),[L,S]=(0,e.useState)(0),[W,O]=(0,e.useState)(y);if((0,e.useEffect)(()=>{t&&s&&x()},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'function'!=typeof window.matchMedia)return;const e=window.matchMedia('(prefers-reduced-motion: reduce)'),n=()=>O(!!e.matches);return n(),e.addEventListener?e.addEventListener('change',n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener('change',n):e.removeListener(n)}},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'undefined'==typeof ResizeObserver)return;const e=document.querySelector('[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]');if(!e)return;const n=()=>{const t=e.querySelector('[data-testid="whos-on-shift-list"]');v(e.clientWidth),t&&S(Math.max(t.scrollWidth,t.offsetWidth))},o=new ResizeObserver(n);o.observe(e);const l=e.querySelector('[data-testid="whos-on-shift-list"]');return l&&o.observe(l),n(),()=>o.disconnect()},[t,s,I.length,D]),t&&s){const e=k>0&&L>k+1&&f&&!W,t=w.find(e=>e>=Math.round((L+48)/32))??80,s=0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,numberOfLines:1,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",children:(0,h.jsx)(b,{rows:I,testIds:!0})});return(0,h.jsxs)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:0,paddingHorizontal:10,height:44,maxHeight:44,minHeight:44,overflow:'hidden',width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',gap:8},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",numberOfLines:1,style:{flexShrink:0},children:r.CARD_TITLE}),(0,h.jsxs)(n.default,{testID:"whos-on-shift-marquee",onLayout:e=>v(e.nativeEvent.layout.width),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,height:44,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:[(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",onLayout:e=>S(e.nativeEvent.layout.width),style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row',flexWrap:'nowrap',flexShrink:0,width:'max-content'},children:(0,h.jsx)(b,{rows:I,testIds:!1})}),e?(0,h.jsxs)(n.default,{dataSet:{ccwho:`tick-${t}`},style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center'},children:[(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:s}),(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:(0,h.jsx)(b,{rows:I,testIds:!1})})]}):(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,width:'max-content'},children:s})]})]})}if(t)return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:d.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:18,colour:d.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:d.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:d.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]);const f='undefined'!=typeof document,w=[18,24,32,40,50,64,80],u=`\n[data-testid="display-whos-on-top"]{overflow:hidden;max-width:100%;width:100%}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"] *{flex-wrap:nowrap!important;white-space:nowrap}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"]{display:inline-flex!important;flex-direction:row;align-items:center;width:max-content!important;max-width:none!important}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]>[data-ccwho],[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;width:max-content}\n${w.map(e=>`[data-testid="display-whos-on-top"] [data-ccwho="tick-${e}"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;animation:ccwho-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccwho-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{animation:none!important}}\n`;let p=!1;function x(){if(!f||p)return;p=!0;const e=document.createElement('style');e.setAttribute('data-ccwho-css','1'),e.textContent=u,document.head.appendChild(e)}const y=()=>f&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;function b({rows:e,testIds:t}){return(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',columnGap:10,flexShrink:0,width:'max-content'},children:e.map(e=>(0,h.jsxs)(n.default,{testID:t?`whos-on-shift-${e.staffId}`:void 0,accessible:t,accessibilityLabel:t?e.speech:void 0,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,numberOfLines:1,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,numberOfLines:1,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})}},1221,[35,237,103,1073,892,1222,822,795,26]); __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1222,[]); __d(function(g,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.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1223,[828,1042,35,403,103,795,1012,822,901,26]); __d(function(g,_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.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1224,[828,797,1225,1143,836,892,35,337,403,103,795,1012,1013,822,896,901,1226,1229,1231,26]); @@ -1426,7 +1426,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}},1343,[828,861,35,103,795,862,868,1168,1344,875,822,26]); __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})},1344,[904,958,1168]); __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]})}},1345,[31,35,873,1346,1416,26]); -__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=e(_r(_d[40])),G=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]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ye.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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:l?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:l?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),s?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.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||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ye.jsx)(Q.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${s.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ye.jsx)(Q.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ye.jsx)(Q.T,{size:12,colour:se.colours.muted,children:l}):null]})}function at({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,s));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:l?16:18,weight:"bold",children:[it(e)," \xb7 ",lt(e.customerName)]}),(0,Ye.jsx)(Q.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,Ye.jsxs)(Q.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,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,le.useRestaurant)(jt);(0,Re.useAlertWatcher)(jt,{enabled:!e});const kt=(0,le.useOrders)(jt),It=(0,le.useBookings)(jt),Dt=(0,le.useEvents)(jt),vt=(0,le.useStore)(e=>e.skipMinutes),St=(0,le.useStore)(e=>e.clock.mode),Ct=(0,le.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Rt=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,Ne.workingShifts)(Rt,Bt),[Rt,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Wt=(0,$.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:lt(Tt.find(e=>e.id===Wt)?.name)}),Ht=I.IS_CAR?'Car':'Display';(0,L.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,ne.useFrontDoor)(Pt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Ft=(0,re.useFloor)(e=>e.live[jt]),Gt=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,el]=(0,H.useState)(null),[tl,ll]=(0,H.useState)(null),[sl,il]=(0,H.useState)(!1),[ol,nl]=(0,H.useState)(!1),[al,rl]=(0,H.useState)(null),[dl,cl]=(0,H.useState)(!1),[ul,hl]=(0,H.useState)(!1),[gl,bl]=(0,H.useState)(!1),[yl,pl]=(0,H.useState)(null),[fl,xl]=(0,H.useState)(null),[ml,jl]=(0,H.useState)(null),[wl,kl]=(0,H.useState)(!1),Il=P.default.useRef(0),Dl=e=>{Il.current=Date.now(),jl(e)};P.default.useEffect(()=>{if(!ml)return;const e=setInterval(()=>{Date.now()-Il.current>=He.DAY_IDLE_MS&&jl(null)},5e3);return()=>clearInterval(e)},[ml]);const vl=(0,le.useWaitlist)(jt),Sl=(0,le.useStore)(e=>e.walkIns[jt]??0),[Cl,Tl]=(0,H.useState)(!1),[$l,Rl]=(0,H.useState)(!1),[Bl,Ll]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Wl,zl]=(0,H.useState)({view:0,content:0}),[Hl,Pl]=(0,H.useState)(null);P.default.useEffect(()=>{Hl&&((0,W.notify)({id:`floor-note:${Date.now()}`,title:Hl,timeoutMs:4500,big:!0,testID:'floor-toast'}),Pl(null))},[Hl]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Ml,Al]=(0,H.useState)(null),El=P.default.useRef(0),[Ol,Nl]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ml)return;El.current=Date.now();const e=setInterval(()=>{const e=Date.now()-El.current;if(e>=Xe)return Al(null),void Pl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nl(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ml]);const _l=e=>e.date!==Pt?ll({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!ci.ok,accessibilityHint:ci.hint,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ll({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ll(null),Pl(e)}}):null,e.walkIn?(0,Ye.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ll(null),Pl(e)}}):null,(0,Se.bookingDetails)(e)]})}),Fl=It.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),Gl=Fl.filter(e=>!['cancelled','noshow'].includes(e.status)),Vl=kt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ul=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),Kl=(0,Be.closedAreasAt)(Gt,jt,Pt,(0,te.hm)(Ct)),ql=[...Kl].join(','),Yl=(0,H.useMemo)(()=>(0,de.floorView)(_t,It,kt,Ft??{},Ct,wt.settings.turnMins,Kl),[_t,It,kt,Ft,Ct.getTime(),ql]),Ql=(0,ve.hoursFor)(wt,Ct),Jl=Ql?.open??new Date(`${Pt}T12:00:00`),Xl=Ql?.close??new Date(`${Pt}T21:00:00`),Zl=(0,te.addMins)(Jl,-Jl.getMinutes()),es=(0,te.addMins)(Xl,30),ts=e=>new Date(`${Pt}T${e}:00`),ls=(0,Be.blocksOn)(Gt,jt,Pt).map(e=>({from:ts(e.from),to:ts(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Pt)),ss=Object.keys(Yl).filter(e=>'blocked'===Yl[e]?.status),is=ml&&ml!==Pt?ml:Pt,os=is!==Pt,ns=(0,He.dayWord)(is,Pt),as=/^(Today|Yesterday|Tomorrow)$/.test(ns),rs=os?(0,He.bookingsForDay)(It,is,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Fl,ds=(0,te.parseYmd)(is);ds.setHours(12);const cs=os?(0,ve.hoursFor)(wt,ds):Ql,us=cs?.open??new Date(`${is}T12:00:00`),hs=cs?.close??new Date(`${is}T21:00:00`),gs=e=>new Date(`${is}T${e}:00`),bs=[...os?(0,Be.blocksOn)(Gt,jt,is).map(e=>({from:gs(e.from),to:gs(e.to),label:e.reason??'Paused'})):ls,...os?(0,o.queuedServicePauses)(wt,ds,is):[]],ys=(0,o.queuedServiceSessions)(wt,ds),ps=s.IS_QUEUED_VENUE&&(void 0===ys||!ys.length),fs=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ys?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),xs=os?cs||rs.length?isos?(0,de.dayFloorView)(_t,rs,is):Yl,[os,_t,rs,is,Yl]),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),[Ss,Cs]=(0,H.useState)(null),Ts=os?rs.filter(e=>!['cancelled','noshow'].includes(e.status)):Gl,$s=Ts.reduce((e,t)=>e+t.partySize,0),Rs=(0,u.coversSplit)(Ts,is),Bs=(0,Me.cancelledDayTally)(It,is),Ls=(0,Ae.cancellationsFor)(It,is,e=>e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Ws=(0,Me.cancelledTallyWords)(Bs,as?ns.toLowerCase():os?`on ${ns}`:'today'),zs=Gt.filter(e=>e.rid===jt&&e.date===is&&!e.removedAt),Hs=(0,ze.chartBands)(zs,60*us.getHours()+us.getMinutes(),60*hs.getHours()+hs.getMinutes()),Ps=new Set((0,ze.blockedHours)(Hs)),Ms=Ct.getHours()+(Ct.getMinutes()>=30?1:0),As=Ul.hours.filter(e=>e.hour>=Ms&&!Ps.has(e.hour)),Es=As.reduce((e,t)=>e+t.coversHigh,0),Os=As.reduce((e,t)=>e+t.coversLow,0),Ns=Math.round((Os+Es)/2),_s=!Ul.example&&Ul.open&&Ul.enough&&Es>0?`Usually ${(0,c.coversRange)(Ns,Ns)} more`:void 0,Fs=async(e,t)=>{const l=Yl[e]?.booking;if(!l||e===t)return;const s=Yl[t]?.status;if(s&&!['free','soon'].includes(s))return void Pl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Pl,{b:l,tables:[t]}))return;await le.repo.bookings.update(l.id,{table:t});const i=Ft?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Pl(`Saving: ${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(l.id,`${(0,xe.privName)(l,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}`,Pl)},Gs=e=>{if(fl)return Is(null),void xl(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);os?ws(e):Zt?(e!==Zt&&Fs(Zt,e),el(null)):Xt(e)},Vs=fl?It.find(e=>e.id===fl.id):void 0,Us=fl&&Vs?(()=>{const e=Vs.walkIn?(0,xe.privName)(Vs,Ot):lt(Vs.name),t=(0,De.seatsOf)(_t,fl.tables).total,l=(0,De.seatLine)(t,Vs.partySize),s=(0,De.pickClashes)(Vs,fl.tables,It.filter(e=>e.date===Vs.date),wt.settings.turnMins),i=(0,De.tableKey)(fl.tables)!==(0,De.tableKey)((0,re.tablesOf)(Vs.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(Vs.date,Pt)} ${Vs.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(fl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(Vs.date,Pt)," ",Vs.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:se.colours.text,children:[(0,De.tablesWords)(fl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ks?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ks,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ks})}):null,Ds&&Vs&&fl.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,fl.tables.join('+')),onYes:()=>{vs(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,l,e,t,Pl)})()},onNo:()=>vs(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:ks?'plan-pick-overcap-yes':'plan-pick-save',label:ks?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ks?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(fl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Vs)return void xl(null);if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=(0,De.overCapacityAsk)(fl.tables,t,Vs.partySize);if(l&&!ks)return void Is(l);if('finished'===Vs.status&&fl.tables.length&&!Ds)return void vs(!0);Is(null),vs(!1);const s=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,s,e,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Is(null),xl(null)}})]})]})})():null,Ks=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),qs=e=>{const t=_t.tables.filter(t=>t.areaId===e);return os?`${t.filter(e=>!ms[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Yl[e.name]?.status??'free')).length}/${t.length} free`},Ys='all'===Yt||Ks.some(e=>e.id===Yt)?Yt:'all',Qs=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:ms,privacy:Ot,turnBase:wt.settings.turnMins,highlight:fl?fl.tables:Zt?[Zt]:void 0,onTap:e=>Gs(e.name),onDrop:(e,t)=>fl||os?void 0:Fs(e.name,t.name)}),Js=ut?1:ht||Ks.length>2?2:1,Xs=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=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)/l},Zs=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ti=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:qs(e.id)})]}),li=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(l-xt.h)>1)&&mt({w:t,h:l})},children:ei?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:ei.scroll,showsVerticalScrollIndicator:ei.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:ei.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:ei.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=Ks.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ei.cellW,gap:2},children:[ti(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:Qs(e)})]},e)})},t))}):null}),si=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Ys,onPress:()=>Qt('all')},"__all"),...Ks.map(e=>(0,Ye.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ut?Kl.has(e.id)?'closed':Ys===e.id?qs(e.id):void 0:void 0,selected:Ys===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;zl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>zl(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:Wl.view>0&&Wl.content>0&&Wl.content<=Wl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Wl.view>0&&Wl.content<=Wl.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),Us,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>el(null)})]}):null,'all'===Ys&>?li:'all'===Ys?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:Zs.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>Xs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:qs(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:qs(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*Xs(e.id)))}:{flex:1},children:Qs(e.id)})]},e.id)),e.length{if(os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},is)}),oi='timeline'===Vt,ni=Kt?(0,Ye.jsx)(F.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${os?(0,He.dayLong)(is):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),ps?fs:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:os?rs:Fl,now:os?us:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:os?(0,te.addMins)(us,-us.getMinutes()):Zl,t1:os?(0,te.addMins)(hs,30):es,pauses:os?bs:ls,blockedTables:os?[]:ss,onOpen:e=>{if(qt(!1),os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},`full-${is}`)})]})}):null,ai=os?(0,Ye.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:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:as?`Showing ${ns} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(is))}`:`Showing ${(0,He.dayWord)(is,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ws}. Showing ${(0,He.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{xl(null),Dl(null)},style:{minHeight:44}})]}):null,ri=(0,Ye.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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(oi||Kt);return(0,Ye.jsx)(V.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.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,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),di='display'===I.APP_VARIANT&&!e?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ri,(0,Ye.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:Rt,staff:Tt,today:Pt,leave:Bt})]}):ri,ci=(0,h.useBookingWrite)(),ui=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>nl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint})]});(0,qe.useDisplayNotices)(jt,!e);const hi=ut?180:168,[gi,bi]=(0,H.useState)(hi),yi=P.default.useRef(hi),pi=P.default.useRef(null),fi=P.default.useRef(null),xi=()=>{const e=pi.current,t=fi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=ct<820?8:12,o=44+(ct<820?4:8),n=i>yi.current?Math.ceil(i-yi.current):We.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(hi,Math.floor(t-s-l)-n-o));Math.abs(yi.current-a)>=2&&(yi.current=a,bi(a))})})};P.default.useEffect(()=>{const e=setTimeout(xi,60);return()=>clearTimeout(e)},[rt,ct]);const mi=(0,Ye.jsxs)(K.default,{ref:fi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),xi()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Nl(null),Al({at:Date.now()})},onHint:()=>Pl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(Le.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:is}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(Le.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ll(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),ji=Vl.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:se.colours.muted,children:[Vl.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Vl,me:zt,compact:!0,bookings:It})})]}):null,wi=(Oe.DueToday,wt.settings.turnMins||90),ki=os?rs:(0,v.todaysGuestList)(Fl,Ct,wi),Ii=os?[]:(0,v.todaysFinishedList)(Fl,Ct,wi),Di=os?as?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',vi=(0,Ye.jsxs)(Ye.Fragment,{children:[0===ki.length?(0,Ye.jsx)(Q.Muted,{children:os?is{const t=(0,v.isLeftEarly)(e,Ct,wi),l=(0,ie.isSeatedHighlight)(e.status,{otherDay:os})&&!t,s=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=se.colours.text,o=l?se.colours.goldLight:se.colours.muted,n=se.colours.gold,a=s.depositWarn?se.colours.amber:se.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:os?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(_.AllergyIcon,{text:s.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,s.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ii.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ii.length}${gl?', expanded':', collapsed'}`,accessibilityState:{expanded:gl},onPress:()=>bl(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ii.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:se.colours.muted,children:gl?'\u25be':'\u25b8'})]}),gl?Ii.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:ci.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Ee.CancellationsSection,{items:Ls,dayWord:os?as?ns.toLowerCase():`on ${ns}`:'today'})]}),Si=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:vi}),Ci=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&hl(!1)}}),Ti=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Di}, ${ki.length}`,accessibilityState:{expanded:ul},'aria-expanded':ul,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:ul?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:ul?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:se.colours.gold,children:ki.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Di," ",ul?'\u2039':'\u203a']})})})]}),$i=ul?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...Ci.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Di.toUpperCase()," (",ki.length,")"]}),(0,Ye.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Di}`,onPress:()=>hl(!1),style:{marginRight:-6}})]}),Bs.count?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Ws}):null]}),Si]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Di}`,accessibilityRole:"button",onPress:()=>hl(!1),style:{flex:1}})]}):null,Ri=ps?fs:s.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:rs,open:us,close:hs,now:Ct,turnBase:wt.settings.turnMins,blocks:zs,pauses:bs,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:hi,forecastNote:os?void 0:_s,emptyText:xs,past:is{Il.current=Date.now(),kl(!0)},shortDay:!ut&&rt<1100}),Wi=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:wl,today:Pt,day:is,bookings:It,restaurant:wt,now:Ct,onDay:Dl,onClose:()=>kl(!1)}),zi=()=>{os?hl(!0):qt(!0)},Hi=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ct<820?8:12,paddingTop:ct<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[Mt?null:Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:ai,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):oi?ii:si,ni,$i]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ui(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:di}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:ct<820,snug:ct<820,tight:ct<700,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{ref:pi,testID:"day-graph-slot",onLayout:xi,style:{flexGrow:0,flexShrink:1,flexBasis:hi+52,minHeight:ct<=600?90:120,overflow:'visible'},children:Bi}),(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),ji,(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Il.current=Date.now()},onMouseDown:()=>{Il.current=Date.now()},children:[ut?(0,Ye.jsxs)(K.default,{style:{flex:1},children:[(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt}),Li,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(ot,{phone:!0,split:Rs,items:[{label:`Tables \xb7 ${ns}`,value:Ts.length,testID:'badge-tables'},{label:`Covers \xb7 ${ns}`,value:$s,testID:'badge-covers'},{label:'Takeaway',value:Vl.length,alert:Vl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>il(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ui(!0)}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),di,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[oi?ii:si,ni]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Di," (",ki.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{gap:4},children:vi})]}),ji,Bi,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),mi]}),e?null:(0,Ye.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:se.colours.hairline},children:(0,Ye.jsx)(N.VoiceSlot,{size:56})})]}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ct<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ye.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Li}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,Ye.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.muted,children:"?"})}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,e?null:(0,Ye.jsx)(j.ExitButton,{}),ee,Ue?null:(0,Ye.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,!I.IS_CAR&&Mt?(0,Ye.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(ot,{splitOnly:!0,split:Rs,items:[]})})]})}),gt?Hi:(Pi=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ui(!1)}),di]}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[ai,oi?ii:si,ni,$i]})]})}),ji,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:hi+We.DAY_GRAPH_CHROME},children:Bi})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Pi})),mi]}),(0,Ye.jsx)(R.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ll(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Bl,onClose:()=>Ll(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ol?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>nl(!1)}):null,al?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:al,who:zt,onClose:()=>rl(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Yl,plan:_t,todays:Fl,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>el(e),onDetails:_l}):null,js?(()=>{const e=ms[js],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Cs(null),ws(null)},title:`${(0,d.tableNumbersA11y)(js)} \xb7 ${as?ns:(0,He.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${as?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${as?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Ot):lt(e.name);return(0,Ye.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ws(null),pl(e.id)},style:{minHeight:56}},e.id)}),is>=Pt?(()=>{const t=e?.table.maxSeats??0,l=It.filter(e=>e.date===is&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(js)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(js)]}),Ss?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Ss.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Ss.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ci.ok,accessibilityHint:ci.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Ss.id);if(Cs(null),!e)return;const l=lt(e.name);ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Cs(null)})]})]}):null,Ss?null:l.slice(0,12).map(e=>{const l=lt(e.name),s=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ci.ok,accessibilityHint:ci.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(js)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:e,tables:[js]}))return;const s=(0,De.overCapacityAsk)([js],t,e.partySize);s?Cs({id:e.id,ask:s}):(ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Cs(null),ws(null)},style:{minHeight:56}})]})})():null,yl?(()=>{const e=It.find(e=>e.id===yl);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Ot):lt(e.name),view:Yl,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>pl(null),onDetails:_l,onDone:Pl,onEdit:e=>{pl(null),rl(e.id)},onPickOnPlan:(e,t)=>{hl(!1),Ut('plan'),Qt('all'),xl({id:e.id,tables:t})}}):null})():null,tl?(0,Ye.jsx)(Se.DetailsPanel,{title:tl.title,onClose:()=>ll(null),children:tl.body}):null,Wi,dl?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Fl,orders:kt,waitlistAll:vl,walkInCount:Sl,onClose:()=>cl(!1)}):null,Cl?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Tl(!1)})]}):null,$l?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Rl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Rl(!1)})]}):null,sl?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>il(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Vl,me:zt,bookings:It})]}):null,Ml?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{El.current=Date.now(),null!==Ol&&Nl(null)},notice:null!==Ol?`Locking again in ${Ol} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Al(null),Pl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Pl('Live seating plan updated on every screen.')},onCancel:()=>{Al(null),Pl('No changes kept. Editing is locked again.')}},Ml.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)($e.TakeawayTakeover,{rid:jt,me:zt})]});var Pi}function dt({rid:e,id:t,turnBase:l}){const s=(0,le.useBookings)(e).find(e=>e.id===t);return s?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); +__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,qe.jsx)(rt,{...e}):(0,qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Q.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]),o=_r(_d[4]),n=_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]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_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]),H=_r(_d[32]),z=_r(_d[33]),M=e(z),P=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_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])),Y=e(_r(_d[45])),q=_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]),oe=_r(_d[56]),ne=_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]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_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]),He=_r(_d[85]),ze=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_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]),Ye=_r(_d[99]),qe=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?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)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,qe.jsx)(Q.T,{size:s?14:12,colour:le.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)(M.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||o?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)(Q.T,{size:14,colour:le.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)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Q.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:le.colours.gold},children:[(0,qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){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:n?4:7,minHeight:44,paddingHorizontal:n?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:[o?(0,qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,qe.jsx)(Q.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.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:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,qe.jsx)(Q.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)(Q.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)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,Y.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=M.default.useRef(null),xt=M.default.useRef(0),[ft,mt]=(0,z.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const kt=(0,se.useOrders)(jt),It=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),Rt=(0,oe.useOwner)(e=>e.attendance),$t=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Wt=M.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);M.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Mt=(0,te.ymd)(Ct),Pt=(0,A.useTravelDay)('display',Mt),At=(0,ne.useFrontDoor)(Mt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,xe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,z.useState)('plan'),[Kt,Yt]=(0,z.useState)(!1),[qt,Qt]=(0,z.useState)('all'),[Jt,Xt]=(0,z.useState)(null),[Zt,es]=(0,z.useState)(null),[ts,ss]=(0,z.useState)(null),[ls,is]=(0,z.useState)(!1),[os,ns]=(0,z.useState)(!1),[as,rs]=(0,z.useState)(null),[ds,cs]=(0,z.useState)(!1),[us,hs]=(0,z.useState)(!1),[gs,bs]=(0,z.useState)(!1),[ys,ps]=(0,z.useState)(null),[xs,fs]=(0,z.useState)(null),[ms,js]=(0,z.useState)(null),[ws,ks]=(0,z.useState)(!1),Is=M.default.useRef(0),Ds=e=>{Is.current=Date.now(),js(e)};M.default.useEffect(()=>{if(!ms)return;const e=setInterval(()=>{Date.now()-Is.current>=ze.DAY_IDLE_MS&&js(null)},5e3);return()=>clearInterval(e)},[ms]);const vs=(0,se.useWaitlist)(jt),Ss=(0,se.useStore)(e=>e.walkIns[jt]??0),[Cs,Ts]=(0,z.useState)(!1),[Rs,$s]=(0,z.useState)(!1),[Bs,Ws]=(0,z.useState)(!1),[Ls,Hs]=(0,z.useState)(!1);(0,X.useReviewAlerts)(jt);const[zs,Ms]=(0,z.useState)({view:0,content:0}),[Ps,As]=(0,z.useState)(null);M.default.useEffect(()=>{Ps&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Ps,timeoutMs:4500,big:!0,testID:'floor-toast'}),As(null))},[Ps]),M.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Es,Os]=(0,z.useState)(null),Ns=M.default.useRef(0),[_s,Gs]=(0,z.useState)(null);M.default.useEffect(()=>{if(!Es)return;Ns.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Ns.current;if(e>=Xe)return Os(null),void As('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Gs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Fs=e=>e.date!==Mt?ss({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Mt)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!hi.ok,accessibilityHint:hi.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),As(e)}}):null,e.walkIn?(0,qe.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Mt,onDone:e=>{ss(null),As(e)}}):null,(0,Se.bookingDetails)(e)]})}),Vs=It.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Us=Vs.filter(e=>!['cancelled','noshow'].includes(e.status)),Ks=kt.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,z.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),qs=(0,Be.closedAreasAt)(Ft,jt,Mt,(0,te.hm)(Ct)),Qs=[...qs].join(','),Js=(0,z.useMemo)(()=>(0,de.floorView)(_t,It,kt,Gt??{},Ct,wt.settings.turnMins,qs),[_t,It,kt,Gt,Ct.getTime(),Qs]),Xs=(0,ve.hoursFor)(wt,Ct),Zs=Xs?.open??new Date(`${Mt}T12:00:00`),el=Xs?.close??new Date(`${Mt}T21:00:00`),tl=(0,te.addMins)(Zs,-Zs.getMinutes()),sl=(0,te.addMins)(el,30),ll=e=>new Date(`${Mt}T${e}:00`),il=(0,Be.blocksOn)(Ft,jt,Mt).map(e=>({from:ll(e.from),to:ll(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Mt)),ol=Object.keys(Js).filter(e=>'blocked'===Js[e]?.status),nl=ms&&ms!==Mt?ms:Mt,al=nl!==Mt,rl=(0,ze.dayWord)(nl,Mt),dl=/^(Today|Yesterday|Tomorrow)$/.test(rl),cl=al?(0,ze.bookingsForDay)(It,nl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):Vs,ul=(0,te.parseYmd)(nl);ul.setHours(12);const hl=al?(0,ve.hoursFor)(wt,ul):Xs,gl=hl?.open??new Date(`${nl}T12:00:00`),bl=hl?.close??new Date(`${nl}T21:00:00`),yl=e=>new Date(`${nl}T${e}:00`),pl=[...al?(0,Be.blocksOn)(Ft,jt,nl).map(e=>({from:yl(e.from),to:yl(e.to),label:e.reason??'Paused'})):il,...al?(0,o.queuedServicePauses)(wt,ul,nl):[]],xl=(0,o.queuedServiceSessions)(wt,ul),fl=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),ml=(0,qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),jl=al?hl||cl.length?nlal?(0,de.dayFloorView)(_t,cl,nl):Js,[al,_t,cl,nl,Js]),[kl,Il]=(0,z.useState)(null),[Dl,vl]=(0,z.useState)(null),[Sl,Cl]=(0,z.useState)(!1),[Tl,Rl]=(0,z.useState)(null),$l=al?cl.filter(e=>!['cancelled','noshow'].includes(e.status)):Us,Bl=$l.reduce((e,t)=>e+t.partySize,0),Wl=(0,u.coversSplit)($l,nl),Ll=(0,Pe.cancelledDayTally)(It,nl),Hl=(0,Ae.cancellationsFor)(It,nl,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),zl=(0,Pe.cancelledTallyWords)(Ll,dl?rl.toLowerCase():al?`on ${rl}`:'today'),Ml=Ft.filter(e=>e.rid===jt&&e.date===nl&&!e.removedAt),Pl=(0,He.chartBands)(Ml,60*gl.getHours()+gl.getMinutes(),60*bl.getHours()+bl.getMinutes()),Al=new Set((0,He.blockedHours)(Pl)),El=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Ol=Ys.hours.filter(e=>e.hour>=El&&!Al.has(e.hour)),Nl=Ol.reduce((e,t)=>e+t.coversHigh,0),_l=Ol.reduce((e,t)=>e+t.coversLow,0),Gl=Math.round((_l+Nl)/2),Fl=!Ys.example&&Ys.open&&Ys.enough&&Nl>0?`Usually ${(0,c.coversRange)(Gl,Gl)} more`:void 0,Vl=async(e,t)=>{const s=Js[e]?.booking;if(!s||e===t)return;const l=Js[t]?.status;if(l&&!['free','soon'].includes(l))return void As('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(As,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),As(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,As)},Ul=e=>{if(xs)return vl(null),void fs(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);al?Il(e):Zt?(e!==Zt&&Vl(Zt,e),es(null)):Xt(e)},Kl=xs?It.find(e=>e.id===xs.id):void 0,Yl=xs&&Kl?(()=>{const e=Kl.walkIn?(0,fe.privName)(Kl,Ot):st(Kl.name),t=(0,De.seatsOf)(_t,xs.tables).total,s=(0,De.seatLine)(t,Kl.partySize),l=(0,De.pickClashes)(Kl,xs.tables,It.filter(e=>e.date===Kl.date),wt.settings.turnMins),i=(0,De.tableKey)(xs.tables)!==(0,De.tableKey)((0,re.tablesOf)(Kl.table));return(0,qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Kl.date,Mt)} ${Kl.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Kl.date,Mt)," ",Kl.time]}),(0,qe.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Dl?(0,qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Dl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,qe.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Dl})}):null,Sl&&Kl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Cl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,s,e,t,As)})()},onNo:()=>Cl(!1)}):null,(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:Dl?'plan-pick-overcap-yes':'plan-pick-save',label:Dl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Dl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Kl)return void fs(null);if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=(0,De.overCapacityAsk)(xs.tables,t,Kl.partySize);if(s&&!Dl)return void vl(s);if('finished'===Kl.status&&xs.tables.length&&!Sl)return void Cl(!0);vl(null),Cl(!1);const l=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,l,e,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),fs(null)}})]})]})})():null,ql=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),Ql=e=>{const t=_t.tables.filter(t=>t.areaId===e);return al?`${t.filter(e=>!wl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Js[e.name]?.status??'free')).length}/${t.length} free`},Jl='all'===qt||ql.some(e=>e.id===qt)?qt:'all',Xl=e=>(0,qe.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:wl,privacy:Ot,turnBase:wt.settings.turnMins,highlight:xs?xs.tables:Zt?[Zt]:void 0,onTap:e=>Ul(e.name),onDrop:(e,t)=>xs||al?void 0:Vl(e.name,t.name)}),Zl=ut?1:ht||ql.length>2?2:1,ei=e=>{const t=_t.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},ti=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),ft.w,ft.h):null,li=e=>(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:Ql(e.id)})]}),ii=(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-ft.w)>1||Math.abs(s-ft.h)>1)&&mt({w:t,h:s})},children:si?(0,qe.jsx)(U.default,{style:{flex:1},scrollEnabled:si.scroll,showsVerticalScrollIndicator:si.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:si.rows.map((e,t)=>(0,qe.jsx)(K.default,{style:{height:si.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=ql.find(t=>t.id===e);return(0,qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:si.cellW,gap:2},children:[li(t),(0,qe.jsx)(K.default,{style:{flex:1},children:Xl(e)})]},e)})},t))}):null}),oi=(0,qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:_t}),_t.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)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Q.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)(Q.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)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Jl,onPress:()=>Qt('all')},"__all"),...ql.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?qs.has(e.id)?'closed':Jl===e.id?Ql(e.id):void 0:void 0,selected:Jl===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(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;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(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:zs.view>0&&zs.content>0&&zs.content<=zs.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:zs.view>0&&zs.content<=zs.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),Yl,Zt?(0,qe.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,qe.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===Jl&>?ii:'all'===Jl?(0,qe.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ti.map((e,t)=>(0,qe.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ei(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{center:!0,children:Ql(e.id)})]}):(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{children:Ql(e.id)})]}),(0,qe.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ei(e.id)))}:{flex:1},children:Xl(e.id)})]},e.id)),e.length{if(al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},nl)}),ai='timeline'===Vt,ri=Kt?(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:le.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:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.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)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${al?(0,ze.dayLong)(nl):'Today'}`})}),rt<600?null:(0,qe.jsx)(K.default,{style:{minWidth:180}})]}),fl?ml:(0,qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:al?cl:Vs,now:al?gl:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:al?(0,te.addMins)(gl,-gl.getMinutes()):tl,t1:al?(0,te.addMins)(bl,30):sl,pauses:al?pl:il,blockedTables:al?[]:ol,onOpen:e=>{if(Yt(!1),al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},`full-${nl}`)})]})}):null,di=al?(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:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:dl?`Showing ${rl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(nl))}`:`Showing ${(0,ze.dayWord)(nl,Mt)}`}),(0,qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${zl}. Showing ${(0,ze.dayLong)(nl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{fs(null),Ds(null)},style:{minHeight:44}})]}):null,ci=(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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(ai||Kt);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?(Ut('plan'),Yt(!0)):(Yt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.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)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ui='display'===I.APP_VARIANT&&!e?(0,qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ci,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:$t,staff:Tt,today:Mt,leave:Bt})]}):ci,hi=(0,h.useBookingWrite)(),gi=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint})]});(0,Ye.useDisplayNotices)(jt,!e);const bi=!e&&!I.IS_CAR&&!ut,yi=ut?180:202,[pi,xi]=(0,z.useState)(ut?180:168),fi=M.default.useRef(ut?180:168),mi=M.default.useRef(null),ji=M.default.useRef(null),wi=M.default.useRef(null),ki=!ut&&ct<=800,Ii=()=>{const e=mi.current,t=ji.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l)=>{const i=t>fi.current?Math.ceil(t-fi.current):0,o=Math.max(Le.DAY_GRAPH_CHROME+(ki?24:8),i),n=!ut&&ct>=700?140:70,a=Math.floor(s-4-e)-o-l,r=Math.min(yi,a>=n?Math.max(n,a):Math.max(0,a));Math.abs(fi.current-r)>=2&&(fi.current=r,xi(r))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,o,n,a)=>{t.measureInWindow((e,t)=>{const n=wi.current;bi&&n?.measureInWindow?n.measureInWindow((e,l,n,r)=>{const d=ct<820?4:8;s(o,a,t,Math.max(i,44+d+Math.round(r||0)))}):s(o,a,t,bi?i:l)})})};M.default.useEffect(()=>{const e=setTimeout(Ii,60);return()=>clearTimeout(e)},[rt,ct]);const Di=(0,qe.jsxs)(K.default,{ref:ji,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ii()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:ki?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ke.DisplayClockButton,{}),(0,qe.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Gs(null),Os({at:Date.now()})},onHint:()=>As('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:Ht,quiet:!0,display:!0,day:nl}),_t.areas.some(e=>e.outdoor)?(0,qe.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,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:()=>Hs(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(x.GiftQrButton,{rid:jt,venue:wt.name})]}),vi=Ks.length?(0,qe.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ks.length," live"]})]}),(0,qe.jsx)(K.default,{style:{padding:10},children:(0,qe.jsx)(at,{list:Ks,me:Ht,compact:!0,bookings:It})})]}):null,Si=(Oe.DueToday,wt.settings.turnMins||90),Ci=al?cl:(0,v.todaysGuestList)(Vs,Ct,Si),Ti=al?[]:(0,v.todaysFinishedList)(Vs,Ct,Si),Ri=al?dl?`${rl}\u2019s guests`:`Guests ${rl}`:'Today\u2019s guests',$i=(0,qe.jsxs)(qe.Fragment,{children:[0===Ci.length?(0,qe.jsx)(Q.Muted,{children:al?nl{const t=(0,v.isLeftEarly)(e,Ct,Si),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:al})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,o=s?le.colours.goldLight:le.colours.muted,n=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:al?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:l.time}),(0,qe.jsx)(Q.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)(_.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,qe.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?o:i,children:l.table}),l.dog?(0,qe.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ti.length?(0,qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ti.length}${gs?', expanded':', collapsed'}`,accessibilityState:{expanded:gs},onPress:()=>bs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",Ti.length,")"]}),(0,qe.jsx)(Q.T,{size:16,colour:le.colours.muted,children:gs?'\u25be':'\u25b8'})]}),gs?Ti.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(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:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Q.T,{size:15,colour:le.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:jt,today:Mt,who:t.name,allowed:hi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ee.CancellationsSection,{items:Hl,dayWord:al?dl?rl.toLowerCase():`on ${rl}`:'today'})]}),Bi=(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:$i}),Wi=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&&hs(!1)}}),Li=(0,qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ri}, ${Ci.length}`,accessibilityState:{expanded:us},'aria-expanded':us,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:Ci.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)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[Ri," ",us?'\u2039':'\u203a']})})})]}),Hi=us?(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",...Wi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.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,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Ri.toUpperCase()," (",Ci.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Ri}`,onPress:()=>hs(!1),style:{marginRight:-6}})]}),Ll.count?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:zl}):null]}),Bi]}),(0,qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ri}`,accessibilityRole:"button",onPress:()=>hs(!1),style:{flex:1}})]}):null,zi=fl?ml:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:cl,open:gl,close:bl,now:Ct,turnBase:wt.settings.turnMins,blocks:Ml,pauses:pl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?pi:yi,forecastNote:al?void 0:Fl,emptyText:jl,past:nl{Is.current=Date.now(),ks(!0)},shortDay:!ut&&rt<1100}),Ai=(0,qe.jsx)(Me.DisplayCalendar,{visible:ws,today:Mt,day:nl,bookings:It,restaurant:wt,now:Ct,onDay:Ds,onClose:()=>ks(!1)}),Ei=()=>{al?hs(!0):Yt(!0)},Oi=(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ki?4:ct<820?8:12,paddingTop:ki?bi?2:4:ct<820?bi?4:6:bi?8:10,gap:ki?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:di,Pt?(0,qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,today:Mt,app:"display"})}):ai?ni:oi,ri,Hi]}),(0,qe.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:gi(!1)}),(0,qe.jsx)(K.default,{style:{flexShrink:0},children:ui}),Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:ct<820,snug:ct<820,tight:ct<800,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{ref:mi,testID:"day-graph-slot",onLayout:Ii,style:{flexGrow:0,flexShrink:1,flexBasis:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),height:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),minHeight:ct<=600?90:Math.min((ut?yi:pi)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:Mi}),(0,qe.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[bi?null:(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),vi,(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht})]}),bi&&!Pt?(0,qe.jsx)(K.default,{ref:wi,testID:"display-side-split",style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})}):null]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{Is.current=Date.now()},onMouseDown:()=>{Is.current=Date.now()},children:[ut?(0,qe.jsxs)(K.default,{style:{flex:1},children:[(0,qe.jsxs)(U.default,{ref:pt,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)(Z.RestaurantLogo,{rid:jt,size:64}),(0,qe.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,qe.jsx)(Z.PoweredBy,{}),(0,qe.jsx)(H.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,qe.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:"m"}),(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt}),Pi,(0,qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(ot,{phone:!0,split:Wl,items:[{label:`Tables \xb7 ${rl}`,value:$l.length,testID:'badge-tables'},{label:`Covers \xb7 ${rl}`,value:Bl,testID:'badge-covers'},{label:'Takeaway',value:Ks.length,alert:Ks.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:gi(!0)}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),ui,(0,qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ai?ni:oi,ri]}),(0,qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[Ri," (",Ci.length,")"]}),(0,qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{gap:4},children:$i})]}),vi,Mi,(0,qe.jsx)(K.default,{testID:"covers-dock",children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.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)(Q.T,{center:!0,size:14,colour:Ot?le.colours.muted:le.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,qe.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Di]}),e?null:(0,qe.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:le.colours.hairline},children:(0,qe.jsx)(N.VoiceSlot,{size:56})})]}):(0,qe.jsxs)(qe.Fragment,{children:[bi?(0,qe.jsxs)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,n.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.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})}),(0,qe.jsx)(V.default,{testID:"display-more",accessibilityRole:"button",accessibilityLabel:"More",onPress:()=>Ws(!0),style:({pressed:e})=>({minWidth:44,height:44,marginLeft:8,paddingHorizontal:10,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center',flexShrink:0}),children:(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.muted,children:"More"})})]}):null,(0,qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ki?2:ct<820?4:8,gap:8,minHeight:ki&&bi?44:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,qe.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Pt?(0,qe.jsx)(K.default,{style:{width:220}}):(0,qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Pi}),(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:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Pt?null:(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,qe.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.muted,children:"?"})}),'simulated'===St?(0,qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,e?null:(0,qe.jsx)(j.ExitButton,{}),ee,Ue?null:(0,qe.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,I.IS_CAR||!Pt||bi?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Pt||bi?null:(0,qe.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,qe.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(K.default,{style:tt,children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})})]})}),gt?Oi:(Ni=(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:gi(!1)}),ui]}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),Pt?(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,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:[Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[di,ai?ni:oi,ri,Hi]})]})}),vi,Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:yi+Le.DAY_GRAPH_CHROME},children:Mi})]}),(0,qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Ni})),Di]}),(0,qe.jsx)($.SoldOutStrip,{rid:jt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:Ls,onClose:()=>Hs(!1),rid:jt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:jt}),At.elements,os?(0,qe.jsx)(y.EditBookingPicker,{rid:jt,today:Mt,who:Ht,onClose:()=>ns(!1)}):null,as?(0,qe.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:Ht,onClose:()=>rs(null)}):null,Jt?(0,qe.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Js,plan:_t,todays:Vs,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Fs}):null,kl?(()=>{const e=wl[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Rl(null),Il(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${dl?rl:(0,ze.dayLong)(nl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${dl?rl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${dl?rl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):st(e.name);return(0,qe.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Il(null),ps(e.id)},style:{minHeight:56}},e.id)}),nl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===nl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(kl)).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)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Tl?(0,qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Tl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Tl.ask}),(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!hi.ok,accessibilityHint:hi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Tl.id);if(Rl(null),!e)return;const s=st(e.name);Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Rl(null)})]})]}):null,Tl?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,qe.jsx)(Q.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:!hi.ok,accessibilityHint:hi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(As,{b:e,tables:[kl]}))return;const l=(0,De.overCapacityAsk)([kl],t,e.partySize);l?Rl({id:e.id,ask:l}):(Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Rl(null),Il(null)},style:{minHeight:56}})]})})():null,ys?(()=>{const e=It.find(e=>e.id===ys);return e?(0,qe.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):st(e.name),view:Js,now:Ct,otherDay:e.date!==Mt,turnBase:wt.settings.turnMins,onClose:()=>ps(null),onDetails:Fs,onDone:As,onEdit:e=>{ps(null),rs(e.id)},onPickOnPlan:(e,t)=>{hs(!1),Ut('plan'),Qt('all'),fs({id:e.id,tables:t})}}):null})():null,ts?(0,qe.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,Ai,ds?(0,qe.jsx)(Se.ServiceSummary,{r:wt,todays:Vs,orders:kt,waitlistAll:vs,walkInCount:Ss,onClose:()=>cs(!1)}):null,Cs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ts(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ts(!1)})]}):null,Bs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ws(!1),$s(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,Rs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,ls?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,qe.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(at,{list:Ks,me:Ht,bookings:It})]}):null,Es?(0,qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,qe.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Ns.current=Date.now(),null!==_s&&Gs(null)},notice:null!==_s?`Locking again in ${_s} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Os(null),As('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),As('Live seating plan updated on every screen.')},onCancel:()=>{Os(null),As('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,qe.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,qe.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,qe.jsx)(Re.TakeawayTakeover,{rid:jt,me:Ht})]});var Ni}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); __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},1348,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1349,[1005,1073]); @@ -1488,7 +1488,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";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}:{}}))}},1405,[]); __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)}},1406,[879,859,878]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1407,[5,1007,904,958]); -__d(function(g,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,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:w,blocks:M=[],height:v=150,forecastNote:k,emptyText:$,past:D,closed:A,compact:I=!1,dense:C=!1,bare:L=!1,fill:_=!1,fit:z=!1,tight:H=!1,live:O=!1}){const[S,F]=(0,t.useState)(0),[P,R]=(0,t.useState)(0),N=j.getTime()-18e5,B=T.getTime()+36e5,E=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(N),new Date(B),w),[e,N,B,w]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(M,W,X),[M,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=z&&P?Math.max(24,Math.floor(P)):Math.max(48,v-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=C?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:O,past:D,closed:A}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},he=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),de=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&de.push(t.getTime())}const ue=O?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),xe=A?null:O?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,ge=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:de,busiest:xe}):{hours:[],busiest:null},me=he(E),pe=le?he(ae.before):me,fe=le?he(ae.after):'',ye=_&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,we=ge.busiest?.text??(A?'':O?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),Me=U.map(e=>e.spoken).join('. '),ve=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${we?` ${we}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${ve} percent of the way through the day.`:''}${Me?` ${Me}.`:''}`,$e=(0,u.hm)(b),De=Math.max(44,12*$e.length*.7+16),Ae=Math.max(q+2,Math.min(Math.max(0,S-J-De),se(re)-De/2)),Ie=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,z?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:L?4:C?2:10,paddingBottom:L?2:6,backgroundColor:c.colours.bg}],children:[L?null:I?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),L||H?null:A?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ke,onLayout:e=>{F(e.nativeEvent.layout.width),z&&R(e.nativeEvent.layout.height)},style:z?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,v-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,A?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,ge.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:ge.busiest.x+ge.busiest.w/2,y:ge.busiest.y+ge.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:ge.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Ae,top:Ie,minWidth:De,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),ge.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':i(0,f.coverCurve)(e,new Date(N),new Date(B),v),[e,N,B,v]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(w,W,X),[w,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=O&&P?Math.max(24,Math.floor(P)):Math.max(48,M-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=A?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:$,closed:I}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},de=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),he=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&he.push(t.getTime())}const ue=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),ge=I?null:H?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,xe=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:he,busiest:ge}):{hours:[],busiest:null},me=de(E),pe=le?de(ae.before):me,fe=le?de(ae.after):'',ye=z&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ve=xe.busiest?.text??(I?'':H?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),we=U.map(e=>e.spoken).join('. '),Me=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=!I&&K&&K.covers?(0,m.peakOccupancyText)(K.t,K.covers):'',De=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${ke?` ${ke}.`:''}${ve?` ${ve}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${Me} percent of the way through the day.`:''}${we?` ${we}.`:''}`,$e=(0,u.hm)(b),Ie=Math.max(44,12*$e.length*.7+16),Le=Math.max(q+2,Math.min(Math.max(0,S-J-Ie),se(re)-Ie/2)),Ae=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[h.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:C?4:A?2:10,paddingBottom:C?2:6,backgroundColor:c.colours.bg}],children:[C?null:L?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te}),ke?(0,y.jsx)(d.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:ke}):null]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:A?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),C||_?null:I?k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),ke&&!L?(0,y.jsx)(d.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:ke}):k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),C||_||L||!k||!ke?null:(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),C||!_||!ke||L?null:(0,y.jsx)(d.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:ke}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:De,onLayout:e=>{F(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,xe.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:xe.busiest.x+xe.busiest.w/2,y:xe.busiest.y+xe.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:xe.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(d.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Le,top:Ae,minWidth:Ie,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(d.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),xe.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1409,[]); __d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1410,[1092]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1411,[861,1390]); diff --git a/car-app/index.html b/car-app/index.html index 7488a1abebade21b49fc5dda5904eb56a4bfd875..3c35ed7f6de78f6636e08b9c4940b31c012c1507 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 6ef7e5a4de188fecb4f3331e45f9ee10517d7f0a..86e528cc4d884d3afe4b8a07af867f3a33c7cc25 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 db06d43bf5d204fa757527b838ad7cbe49be6e83..055427e0a956378430b2c3a457a1a9f8850e9c2a 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-111e3c3a2c"; +const V = "cc-car-2253439f40"; 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=111e3c3a2c458ac436ad77bf9fc782b53426dbe299d2fa80e2b797ff578df095"]; +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=2253439f4094fd9a69c8ca3e2bed89e19afbe23558512424df340bde2c54d91f"]; // 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 90e44ac71952d923afc04506549b0b9721dceb92..4a0c0a6f0857da47b32b7ad479d3ad97cd0f7473 100644 --- a/chef-app/_expo/static/js/web/bundle.js +++ b/chef-app/_expo/static/js/web/bundle.js @@ -5,7 +5,7 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() !(function(r){let l=0,n=!0===r.RN$useAlwaysAvailableJSErrorHandling?r.RN$handleException:(r,l)=>{throw r};const t={setGlobalHandler(r){n=r},getGlobalHandler:()=>n,reportError(r){n&&n(r,!1)},reportFatalError(r){n&&n(r,!0)},applyWithGuard(r,n,e,a,o){try{return l++,r.apply(n,e)}catch(r){t.reportError(r)}finally{l--}return null},applyWithGuardIfNeeded:(r,l,n)=>t.inGuard()?r.apply(l,n):(t.applyWithGuard(r,l,n),null),inGuard:()=>!!l,guard(r,l,n){if('function'!=typeof r)return console.warn('A function must be passed to ErrorUtils.guard, got ',r),null;const e=l??r.name??'';return function(...l){return t.applyWithGuard(r,n??this,l,null,e)}}};r.ErrorUtils=t})('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof global?global:'undefined'!=typeof window?window:this); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,20]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&!t.PITCH_ANCHORAGE&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=o=>{if(3===o.nodeType){const e=o.nodeValue??'',a=(0,n.pitchText)(e,t.PITCH_ANCHORAGE);return void(a!==e&&(o.nodeValue=a))}if(1!==o.nodeType)return;const a=o;if('INPUT'===a.tagName||'TEXTAREA'===a.tagName){const e=a,o=(0,n.pitchText)(e.value,t.PITCH_ANCHORAGE);o!==e.value&&(e.value=o);const i=e.getAttribute('placeholder');if(i){const o=(0,n.pitchText)(i,t.PITCH_ANCHORAGE);o!==i&&e.setAttribute('placeholder',o)}}for(const e of['aria-label','title']){const o=a.getAttribute(e);if(o){const i=(0,n.pitchText)(o,t.PITCH_ANCHORAGE);i!==o&&a.setAttribute(e,i)}}a.childNodes.forEach(e)},o=()=>{e(document.body),document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE),new MutationObserver(o=>{for(const t of o)'characterData'===t.type?e(t.target):t.addedNodes.forEach(e),'attributes'===t.type&&e(t.target);document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?o():document.addEventListener('DOMContentLoaded',o)}}},1,[2,3,16,18,19]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!0},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!1},2,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return c.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return R}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]);const u={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[6]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},h={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},f={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},b={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},p=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:f,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...u,orderAtTable:!1,pay:h,cashUpRecord:[...l.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:8,bookingNoticeMins:15,autoAcceptUpTo:8},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...u,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],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']},settings:{...u,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],A={by:'Fictional demo',at:'2026-10-26'},T=(t,n,o,s,c,l,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:c,price:l,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:A}),R=[T('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),T('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),T('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),T('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),T('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),T('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),T('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),T('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),T('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),T('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13,15]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="anchorage".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); @@ -1070,7 +1070,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()})},987,[35,988]); __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},988,[985,948,989]); __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'}},989,[985]); -__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.189'},990,[]); +__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.190'},990,[]); __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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},991,[992,993,904,948,988]); __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())}}}},993,[948]); @@ -1244,7 +1244,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 e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1161,[35,403,103,795,868,822,1154,1153,1158,1011,26]); __d(function(g,_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.ChefForecast=function({openPrep:e}){const{r:f,rid:y,now:b}=(0,u.useChef)(6e4),x=(0,l.useBookings)(y),p=(0,l.useOrders)(y),j=(0,l.useEvents)(y),k=(0,a.useRealHistory)(y,b),w=(0,d.ymd)(b),[T,$]=(0,o.useState)(7),{covers:v,enough:C,booked:D,pct:I,day:A,example:L}=(0,u.useForecast)(),M=0===I?`about a usual ${A}`:`${Math.abs(I)}% ${I>0?'busier':'quieter'} than a usual ${A}`,z=(0,o.useMemo)(()=>Array.from({length:T},(e,o)=>{const s=0===o?b:(0,d.addMins)((0,d.parseYmd)(w),1440*o),t=(0,i.forecastToday)(f,x,p,j,s,k??void 0);return{d:s,f:t,booked:t.hours.reduce((e,o)=>e+o.booked,0),covers:t.hours.reduce((e,o)=>e+o.covers,0)}}),[f,x,p,j,w,T,k,b.getTime()/6e5|0]),B=z[0].f,R=z.map(e=>({key:(0,d.ymd)(e.d),label:(0,d.dayShort)(e.d),spoken:(0,d.dayLong)(e.d),value:e.f.open?C?e.covers:e.booked:0,open:!!e.f.open}));return(0,h.jsxs)(t.default,{style:{gap:12},testID:"chef-forecast",children:[(0,h.jsx)(r.Muted,{center:!0,testID:"chef-forecast-busy",children:B.busy.words}),C?null:(0,h.jsx)(a.NotEnoughHistory,{weeks:B.minWeeks,booked:D}),(0,h.jsxs)(r.Card,{children:[(0,h.jsxs)(t.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,h.jsxs)(r.T,{center:!0,weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:[7===T?'This week':`Next ${T} days`," \xb7 ",C?'forecast covers':'booked covers']}),C?B.example?(0,h.jsx)(a.ExampleBadge,{}):(0,h.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"}):null]}),(0,h.jsx)(r.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,h.jsx)(r.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:T===e,onPress:()=>$(e),testID:`chef-forecast-range-${e}`},e))}),(0,h.jsx)(c.DaysLineGraph,{days:R,titleSpoken:`${C?'Forecast':'Booked'} covers for the next ${T} days`})]}),(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:"Covers per day"}),(0,h.jsxs)(t.default,{testID:"chef-forecast-days",children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',paddingVertical:6,borderBottomWidth:1,borderColor:n.colours.hairline},children:[(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{flex:1,textAlign:'left'},children:"Day"}),(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:72,textAlign:'right'},children:"Booked"}),C?(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:84,textAlign:'right'},children:"Forecast"}):null]}),z.map((e,o)=>{const s=0===o;return(0,h.jsxs)(t.default,{testID:`chef-forecast-day-${(0,d.ymd)(e.d)}`,accessible:!0,accessibilityLabel:e.f.open?`${(0,d.dayLong)(e.d)}: ${e.booked} booked${C?`, about ${e.covers} forecast`:''}`:`${(0,d.dayLong)(e.d)}: closed`,style:{flexDirection:'row',alignItems:'center',minHeight:40,borderBottomWidth:o({minHeight:48,borderRadius:12,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:e?n.colours.goldTint:'transparent'}),children:(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,children:"Open prep list \u203a"})})]})]})};var o=_r(_d[0]),s=e(_r(_d[1])),t=e(_r(_d[2])),r=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),d=_r(_d[6]),n=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11])},1162,[35,403,103,795,875,1155,859,822,1163,1159,1158,26]); __d(function(g,_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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1163,[829,35,284,365,237,103,427,798,795,828,822,1164,26]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,l=u,f=Math.max(10,i-s-l),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let M=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(p=n.busiest.t,s+(p-n.t0)/x*f-o/2);M={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var p;return{hours:b,busiest:M}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xf+(t-c)/M*b,w=l.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:p(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',f=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=l.indexOf(n);return t+(o<0?1e3:f[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.peakOccupancyText=function(t,n){const o=String(new Date(t).getHours()).padStart(2,'0');return`Peak ${n} ${1===n?'cover':'covers'} at ${o}:00`},e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,f=u,l=Math.max(10,i-s-f),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let p=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(M=n.busiest.t,s+(M-n.t0)/x*l-o/2);p={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var M;return{hours:b,busiest:p}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xl+(t-c)/p*b,w=f.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:M(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',l=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=f.indexOf(n);return t+(o<0?1e3:l[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); __d(function(g,_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.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,I.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,I.useForecast)(),f=(0,k.ymd)(i),p=(0,R.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),m=p.reduce((e,t)=>e+t.sold,0)||1,x=p.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/m)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),b={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{b[e.ing]=(b[e.ing]??0)+e.qty*t.qty}));const y=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini-fish-goujons','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,$.fmtQty)(Math.ceil(2*(b.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,$.fmtQty)(Math.ceil(10*(b.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,$.fmtQty)(Math.ceil(10*(b.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,$.fmtQty)(Math.ceil(2*(b.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,D.useKitchen)(e=>e.tickPrep),w=[...y.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=w.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,q.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,q.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} Covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,q.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} Covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," Covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,q.jsx)(u.Badge,{kind:S===w.length?'ok':'gold',label:`${S}/${w.length} done`})]}),w.map((t,i)=>{const n=e.prepTicks[t.key];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?C.colours.ok:C.colours.border,backgroundColor:C.colours.surface,marginTop:i===y.length?8:0},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:C.colours.muted}:void 0,children:t.text}),n?(0,q.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,q.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,I.useChef)(),a=(0,I.useWeek)(),d=(0,D.useKitchen)(e=>e.addWaste),[f,p]=(0,o.useState)(e.ingredients[0]?.id),[m,x]=(0,o.useState)(''),[b,y]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),k=Number(m.replace(',','.'))||0,S=k>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*k)),T=w&&S?(0,s.inputQuantity)(l,w,k):0,v=e.waste.filter(e=>(0,I.within7)(e.at,r));return w?(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,q.jsx)(I.Tile,{label:"Waste this week",value:(0,j.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,q.jsx)(I.Tile,{label:"Waste as % of food sales",value:a.sales?(0,I.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,q.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,q.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,q.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>p(e.id)},e.id))})}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:m,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:C.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),(0,q.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,q.jsx)(u.T,{weight:"semibold",colour:C.colours.gold,children:(0,j.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,q.jsxs)(u.Row,{children:[(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(k)-.5)))}),(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(k)+.5))}),(0,q.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:D.WASTE_REASONS.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===b,onPress:()=>y(e)},e))}),(0,q.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:b,cost:Math.round(T*w.cost)}),x('')}}),(0,q.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,q.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,q.jsx)(u.T,{size:14,children:(0,j.gbp)(e.cost)})]},e.id))]}):(0,q.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,I.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,b.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'},c=(0,m.useUnsignedDishes)(i),[x,j]=(0,o.useState)(!1);return x?(0,q.jsx)(m.UnsignedDishList,{rid:i,actor:a,onClose:()=>j(!1),onOpenCards:e}):(0,q.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,q.jsx)(d.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>j(!0),style:({pressed:e})=>({minHeight:48,opacity:e?.85:1}),children:(0,q.jsxs)(u.Card,{style:{alignItems:'center'},highlight:c.length?C.colours.amber:void 0,children:[(0,q.jsx)(u.Muted,{center:!0,children:"Dishes not signed off"}),(0,q.jsx)(u.T,{center:!0,size:20,weight:"bold",children:c.length})]})}),(0,q.jsx)(u.Muted,{children:"The 14 allergens from each recipe card. These are what guests see on the menu, takeaway and the booking allergy check. A red warning means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,q.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,l.map(({card:e,fromCosting:t})=>(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",center:!0,children:e.dish}),(0,q.jsx)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i,r='contains'===i?'Contains':'may'===i?'May contain':n?'In costing recipe, not on card':'Not listed';return(0,q.jsxs)(h.default,{accessible:!0,accessibilityLabel:`${e.dish}, ${s.label}: ${r}`,style:{flexGrow:1,flexBasis:220,minWidth:180,maxWidth:'100%',padding:8,borderRadius:8,backgroundColor:n?C.colours.redBg:C.colours.surface2},children:[(0,q.jsx)(u.T,{center:!0,size:14,weight:"semibold",children:s.label}),(0,q.jsx)(u.T,{center:!0,size:14,colour:n?C.colours.red:'contains'===i?C.colours.gold:C.colours.muted,children:r})]},s.id)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Not listed means the allergen is not recorded on this recipe card. Check any costing warnings before sign-off."}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,q.jsxs)(u.Card,{highlight:s.length?C.colours.red:C.colours.amber,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,q.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,q.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,q.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,p.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,q.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,q.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,I.useChef)(),l=(0,k.ymd)(i),a=(0,D.useKitchen)(e=>e.addTemp),c=(0,x.useOwner)(e=>e.checks),{tick:f,untick:p}=x.useOwner.getState(),[m,b]=(0,o.useState)('fridge'),y=E.find(e=>e.id===m),j={...y,units:y.units.filter(e=>(0,n.chefCanSee)(r,e))},[w,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,M=e.temps.filter(e=>e.at.slice(0,10)===l),B=(e,t,i)=>{const n=c[e];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?p(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,children:t}),(0,q.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:E.map(e=>(0,q.jsx)(u.Chip,{label:e.label,selected:e.id===m,onPress:()=>{b(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===w,onPress:()=>S(e)},e))}),(0,q.jsx)(u.Muted,{children:j.rule}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:C.colours.muted,style:{width:90,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),null===$?null:(0,q.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,q.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:m,unit:w,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,q.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",M.length,")"]}),M.length?M.map(e=>{const t=E.find(t=>t.id===e.kind)?.ok(e.temp);return(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,q.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,q.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?C.colours.ok:'warn'===t?C.colours.amber:C.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,q.jsx)(u.Muted,{children:"None yet today."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,q.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),G.map(e=>B(`${l}:kc-${e.id}`,e.text))]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),F.map(e=>B('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,I.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,v.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??I.CHEF_ID,role:'staff'}),[d?.id]),u=(0,T.useChatOpen)(e=>e.ch);return(0,o.useEffect)(()=>{u&&a('chat')},[u]),(0,q.jsx)(S.ChatAsCtx.Provider,{value:c,children:(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(H,{sub:r,setSub:a}),'live'===r?(0,q.jsx)(_,{}):'soldout'===r?(0,q.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,q.jsx)(V,{}):(0,q.jsx)(U,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),D=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),z=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]),N=_r(_d[36]),W=_r(_d[37]),q=_r(_d[38]);const E=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],F=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],G=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function H({sub:e,setSub:t}){const{total:s}=(0,S.useChatUnread)();return(0,q.jsx)(I.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function U(){return(0,q.jsx)(S.Chat,{go:()=>{}})}function _(){const{rid:e,r:t,me:s,now:i}=(0,I.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))),c=(e,t)=>!!(0,B.statusBlock)(e,t,(0,B.linkedBooking)(e,n)),p=(0,b.ticketView)('chef',d),m=(0,f.useStore)(e=>e.setOrderStatus),x=(0,f.useStore)(e=>e.ackReadiness),j=d.flatMap(e=>(0,w.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,q.jsxs)(h.default,{style:{gap:8},children:[j.length?(0,q.jsx)(u.Banner,{kind:"warn",title:`${j.length} readiness alert${j.length>1?'s':''}`,children:j.map(e=>e.detail).join(' \xb7 ')}):(0,q.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,q.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,p.length?p.map(e=>(0,q.jsxs)(u.Card,{highlight:e.allergies.length&&(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))&&'ready'!==e.status?C.colours.red:void 0,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`Table ${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,q.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,q.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,q.jsxs)(u.T,{size:13,colour:C.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,q.jsx)(M.AllergyChain,{o:e,me:s}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{m(e.id,'preparing',s),'takeaway'===e.type&&x(e.id,'cook',s)}}):null,'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>m(e.id,'ready',s)}):null]})]},e.id)):(0,q.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const K=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,k.ymd)(new Date(s,i-1,n+t))};function V(){const{now:e,today:t}={...(0,I.useChef)(6e4),today:(0,k.ymd)(new Date)},{staff:s,shifts:i}=(0,b.rotaView)('chef',(0,x.useOwner)(e=>e.staff),(0,x.useOwner)(e=>e.shifts)),n=(0,x.useOwner)(e=>e.leave),r=(0,N.canEditKitchenRota)((0,P.useSync)(e=>e.perms)),l=(0,x.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),a=(0,v.weekday)(e),o=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),d=(0,z.useSession)(e=>e.meId),c=(0,P.useSync)(e=>e.staffRef),f=d??c??I.CHEF_ID,p=(0,x.useOwner)(e=>e.staff.find(e=>e.id===f)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(L.BreakRoomCard,{staffId:f,name:p,now:e}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"On now"}),l.length?l.map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,q.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,q.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",v.DAY3[a],")"]}),i.filter(e=>e.date===t).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,W.leaveCovering)(n,e.staffId,e.date)?(0,q.jsx)(u.T,{size:13,colour:C.colours.blue,children:(0,W.leaveLabel)((0,W.leaveCovering)(n,e.staffId,e.date))}):(0,q.jsxs)(u.Muted,{children:[(0,v.fmtH)(e.start),"\u2013",(0,v.fmtH)(e.end)]})]},e.id))]}),r?(0,q.jsx)(u.Card,{children:(0,q.jsx)(A.KitchenRotaEditor,{today:t})}):(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),o.map(e=>(0,q.jsxs)(h.default,{style:{gap:4},children:[(0,q.jsx)(u.T,{size:14,children:e.name}),(0,q.jsx)(u.Row,{wrap:!0,gap:4,children:v.DAY3.map((s,n)=>{const r=i.find(s=>s.staffId===e.id&&s.date===K(t,n-a));return(0,q.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:r?C.colours.goldTint:C.colours.surface2,alignItems:'center'},children:[(0,q.jsx)(u.T,{size:10,colour:C.colours.muted,children:s}),(0,q.jsx)(u.T,{size:10,children:r?`${(0,v.fmtH)(r.start).slice(0,2)}\u2013${(0,v.fmtH)(r.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})]})}},1165,[828,955,1166,836,861,1167,1168,35,403,296,103,795,875,883,1169,892,966,862,868,1172,859,822,1173,1099,1073,1154,1153,1174,870,1158,1011,896,1175,977,958,1178,961,1087,26]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1166,[1153,955]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1167,[828,35,103,795,875,950,892,951,952,953,832,822,26]); @@ -1261,7 +1261,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";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=w,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,l.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,y.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,y.jsx)(w,{today:e}):(0,y.jsx)(I,{today:e})})},_e.KitchenRotaRead=I;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],j=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,k=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,p=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function w({today:e=(0,h.ymd)(new Date)}){const r=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,l.kitchenTeam)(r),[r]),$=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[w,I]=(0,t.useState)(0),S=(0,f.useDateCalendar)(),[v,C]=(0,t.useState)(null),[T,H]=(0,t.useState)(''),P=(0,a.addDays)((0,a.mondayOfDate)(e),7*w),L=(0,a.addDays)(P,6),R=b.map((e,t)=>(0,a.addDays)(P,t)),M=(0,l.kitchenPending)(o,$,P,L).length,O=e=>{H(e),(0,u.announce)(e)},W=0===w?'This week':1===w?'Next week':-1===w?'Last week':`Week of ${k(P)}`;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center',flexWrap:'nowrap'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(w-1),H('')},style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${W}, ${x[0]} ${k(P)} to ${x[6]} ${k(L)}`,style:{alignItems:'center',minWidth:120,flex:1},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:W}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(P)," \u2013 ",j(L)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(w+1),H('')},style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:S.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:S.calOpen,today:e,day:P,showBusy:!0,idPrefix:"krota-cal",onClose:S.closeCal,onDay:t=>{I((0,f.weekOffsetOf)(t??e,e)),H('')}}),d.map(t=>(0,y.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[p(t.nickname||t.name),t.job?(0,y.jsx)(n.T,{size:12,colour:m.colours.muted,children:` ${t.job}`}):null]}),(0,y.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:R.map((i,a)=>{const l=o.find(e=>e.staffId===t.id&&e.date===i),r=!(!l||l.published&&!l.changed),d=`${p(t.nickname||t.name)}, ${x[a]} ${k(i)}, ${l?`${(0,c.fmtH)(l.start)} to ${(0,c.fmtH)(l.end)}${r?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,y.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>C({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:r?'dashed':'solid',borderColor:l?r?m.colours.amber:m.colours.gold:m.colours.border,backgroundColor:e||l?m.colours.goldTint:m.colours.surface2}),children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:i===e?m.colours.gold:m.colours.muted,children:b[a]}),(0,y.jsx)(n.T,{size:10,center:!0,children:l?`${(0,c.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(l.end).slice(0,5)}):(0,y.jsx)(n.T,{size:10,center:!0,colour:m.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,y.jsx)(n.Button,{testID:"krota-publish",kind:M?'primary':'secondary',disabled:!M,label:M?`Publish kitchen rota (${M} ${1===M?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:M?`Publish the kitchen rota for ${W.toLowerCase()}, ${M} ${1===M?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,$,P,L);a.useOwner.getState().setShifts(e.shifts),O(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,y.jsx)(i.default,{testID:"krota-msg",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.goldLight,children:T})}):null,(0,y.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),v?(0,y.jsx)(D,{init:v,onClose:()=>C(null),onSaid:O}):null]})}function I({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:l}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,$]=(0,t.useState)(0),w=(0,f.useDateCalendar)(),I=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),D=(0,a.addDays)(I,6),S=b.map((e,t)=>(0,a.addDays)(I,t)),v=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),C=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${k(I)}`,[T,H]=(0,t.useState)(0),P=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>H(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>$(u-1),style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${C}, ${x[0]} ${k(I)} to ${x[6]} ${k(D)}`,style:{alignItems:'center',minWidth:120},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:C}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(I)," \u2013 ",j(D)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>$(u+1),style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:w.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:w.calOpen,today:e,day:I,showBusy:!0,idPrefix:"krota-read-cal",onClose:w.closeCal,onDay:t=>$((0,f.weekOffsetOf)(t??e,e))}),v.map(t=>(0,y.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:p(t.nickname||t.name)}),(0,y.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=l.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,r.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,r.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,y.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${p(t.nickname||t.name)}, ${x[a]} ${k(s)}, ${u}`,style:{width:P,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.goldTint:m.colours.surface2},children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:s===e?m.colours.gold:m.colours.muted,children:b[a]}),o&&h?(0,y.jsx)(n.T,{size:9,center:!0,colour:m.colours.blue,children:(0,r.leaveLabel)(h).toLowerCase()}):(0,y.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),v.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,y.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function D({init:e,onClose:s,onSaid:r}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=p(o?.nickname||o?.name||''),[u,f]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[j,w]=(0,t.useState)(!1),[I,D]=(0,t.useState)(''),S=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${k(e.date)})`;return(0,y.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${S}`,testID:"krota-sheet",children:(0,y.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,y.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{f(t),x(s)}},e))}),(0,y.jsx)(n.T,{center:!0,children:"Start"}),(0,y.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:f,format:c.fmtH,label:"Start time"}),(0,y.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,y.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,y.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),I?(0,y.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.amber,children:I})}):null,(0,y.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?D(`${d} already has a shift that overlaps on ${S}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),r(`${e.shift?'Changed':'Added'}: ${d}, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!j?(0,y.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&j?(0,y.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",S,"?"]}),(0,y.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),r(`Removed ${d}'s shift on ${S}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,y.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1178,[35,403,103,795,892,961,1087,966,958,1076,859,1111,1067,822,26]); __d(function(g,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.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1179,[1166,955,35,380,103,795,892,966,868,822,1073,1158,1011,1180,26]); __d(function(g,_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.openLink=w,_e.useSheetReminders=C,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=C(),f=(0,b.wd)(l);return(0,j.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,j.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,j.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,j.jsx)($,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,j.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]);function w(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function k(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const S={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},T={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function C(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function $({s:e,open:n,onToggle:o}){const{rid:C,r:$,me:D,now:I}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),M=(0,u.useOrderSheets)(e=>e.markOpened),B=(0,u.useOrderSheets)(t=>t.opened[e.id]),[L,P]=(0,s.useState)({}),[O,R]=(0,s.useState)(''),[A,z]=(0,s.useState)(''),[_,W]=(0,s.useState)(!1),H=(0,h.useShellfish)(C,D,'chef'),K=(0,b.nextDelivery)(e,I),E=(0,b.orderLines)(e,L,O,C),N=($.address??$.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=N.length>=3?N[1]:N[0]??'',U=(0,b.orderMessage)(e,$.name,q,E,D.split(' ')[0],I),Q=e.orderDays.includes((0,b.wd)(I)),Y=(e,t)=>P(n=>({...n,[e.id]:(0,l.stepQuantity)(C,e,n[e.id]||0,t)})),F=t=>{M(e.id,I.toISOString()),w(t)},G='text'===e.method||'whatsapp'===e.method||'phone'===e.method,V=Math.round(100*((0,y.parseMoneyInput)(A)??NaN)),J=H.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),X=J.filter(e=>H.isLow(e.key));return(0,j.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:Q||X.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,j.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[S[e.method]," ",e.name]}),(0,j.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,j.jsx)(i.Muted,{children:e.goods}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,j.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,j.jsx)(i.Badge,{kind:Q?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,j.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,j.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,J.length?(0,j.jsx)(i.Badge,{kind:X.length?'amber':'ok',label:J.map(e=>`${e.icon} ${(0,c.fmtStockCount)(C,e,H.counts[e.key]??0)}`).join(' \xb7 ')}):null,B&&new Date(B).toDateString()===I.toDateString()?(0,j.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,j.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[K?(0,j.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(K),"."]}):null,e.reminder?(0,j.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,j.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,j.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,j.jsxs)(d.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{children:[e.name,e.unit?(0,j.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(C,e),")"]}):null]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Y(e,-1),style:{minWidth:44,minHeight:44}}),(0,j.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(C,e,L[e.id]||0),children:(0,j.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(C,e)?(0,l.fishQtyText)(C,e,L[e.id]||0):L[e.id]||0})}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Y(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,j.jsx)(t.TextInput,{value:O,onChangeText:R,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[T,{minHeight:60}]})]}),G?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(C,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,'online'===e.method?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(C,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,e.priceCapPerKg?(0,j.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,j.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,j.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,j.jsx)(t.TextInput,{testID:"price-found",value:A,onChangeText:e=>z((0,y.sanitiseMoneyTyping)(e)),keyboardType:"decimal-pad",inputMode:"decimal",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[T,{width:120}]})]}),V>0?(0,j.jsx)(i.Badge,{kind:V<=e.priceCapPerKg?'ok':'red',label:V<=e.priceCapPerKg?`${(0,p.gbp)(V)}/kg is under the cap \u2713`:`${(0,p.gbp)(V)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,j.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,j.jsx)(i.T,{size:f.font.small,children:E.length?U:'Add quantities above to write the order.'})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!E.length,onPress:()=>F((0,b.smsLink)(e.number,U))}):null,'whatsapp'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!E.length,onPress:()=>F((0,b.waLink)(e.number,U))}):null,'phone'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>F((0,b.telLink)(e.number))}):null,'online'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>F(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&E.length?(0,j.jsx)(i.Button,{kind:"ghost",label:_?'Copied \u2713':'Copy order',onPress:async()=>{const e=await k(U);W(e),e&&setTimeout(()=>W(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,j.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,j.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1180,[828,836,955,35,380,237,403,103,795,1009,954,956,868,1010,822,1158,14,26]); -__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); +__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',justifyContent:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},1182,[5,823,824,829,237,827]); __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,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',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,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',w:64,h:45}}},1183,[]); __d(function(g,_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(', '))})]})}},1184,[828,1009,1166,955,35,403,103,795,892,868,822,1158,1011,14,26]); @@ -1301,7 +1301,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.AssignRoleSheet=function({name:e,when:s,current:u,onSave:b,onEditTimes:y,onClose:j}){const x={minHeight:o.IS_CAR?64:56,width:'100%'},_=(0,l.cleanBadge)(u);return(0,c.jsxs)(n.Sheet,{visible:!0,onClose:j,title:"Assign a role?",testID:"assign-role-sheet",maxWidth:560,children:[(0,c.jsx)(n.T,{size:18,center:!0,weight:"semibold",children:e}),(0,c.jsx)(n.Muted,{center:!0,children:s}),(0,c.jsxs)(t.default,{style:{gap:8,width:'100%'},children:[l.ROLE_BADGES.map(e=>(0,c.jsx)(n.Button,{kind:_===e?'primary':'secondary',label:e,testID:`assign-role-${h(e)}`,accessibilityLabel:`${e}${_===e?', chosen':''}`,onPress:()=>b(e),style:x},e)),(0,c.jsx)(n.Button,{kind:_?'secondary':'primary',label:"None",testID:"assign-role-none",accessibilityLabel:_?'None, clear the role badge':'None, chosen',onPress:()=>b(void 0),style:x}),y?(0,c.jsx)(n.Button,{kind:"ghost",label:"Edit shift times",testID:"assign-role-edit-times",onPress:y,style:x}):null]})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),o=r(d[4]),c=r(d[5]);const h=e=>e.replace(/\s+/g,'-').toLowerCase()},1218,[35,103,795,1217,873,26]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1219,[35,103,795,892,822,1073,1076,1215,1087,26]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1220,[35,103,1073,822,795,26]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),f=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),u=(0,n.useOwner)(e=>e.staff),x=(0,o.workingNow)(f,u,t),w=(0,o.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:r.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:r.colours.muted,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:r.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:r.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:r.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:r.colours.muted,center:!0,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:r.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:r.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),h=_r(d[7])},1221,[35,103,1073,892,1222,822,795,26]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:t=!1,marquee:s=!1}={}){const{today:u}=(0,o.useCtx)(15e3),p=(0,l.useOwner)(e=>(0,l.liveAttendance)(e.attendance)),j=(0,l.useOwner)(e=>e.staff),I=(0,r.workingNow)(p,j,u),D=(0,r.cardSpeech)(I),[k,v]=(0,e.useState)(0),[L,S]=(0,e.useState)(0),[W,O]=(0,e.useState)(y);if((0,e.useEffect)(()=>{t&&s&&x()},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'function'!=typeof window.matchMedia)return;const e=window.matchMedia('(prefers-reduced-motion: reduce)'),n=()=>O(!!e.matches);return n(),e.addEventListener?e.addEventListener('change',n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener('change',n):e.removeListener(n)}},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'undefined'==typeof ResizeObserver)return;const e=document.querySelector('[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]');if(!e)return;const n=()=>{const t=e.querySelector('[data-testid="whos-on-shift-list"]');v(e.clientWidth),t&&S(Math.max(t.scrollWidth,t.offsetWidth))},o=new ResizeObserver(n);o.observe(e);const l=e.querySelector('[data-testid="whos-on-shift-list"]');return l&&o.observe(l),n(),()=>o.disconnect()},[t,s,I.length,D]),t&&s){const e=k>0&&L>k+1&&f&&!W,t=w.find(e=>e>=Math.round((L+48)/32))??80,s=0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,numberOfLines:1,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",children:(0,h.jsx)(b,{rows:I,testIds:!0})});return(0,h.jsxs)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:0,paddingHorizontal:10,height:44,maxHeight:44,minHeight:44,overflow:'hidden',width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',gap:8},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",numberOfLines:1,style:{flexShrink:0},children:r.CARD_TITLE}),(0,h.jsxs)(n.default,{testID:"whos-on-shift-marquee",onLayout:e=>v(e.nativeEvent.layout.width),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,height:44,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:[(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",onLayout:e=>S(e.nativeEvent.layout.width),style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row',flexWrap:'nowrap',flexShrink:0,width:'max-content'},children:(0,h.jsx)(b,{rows:I,testIds:!1})}),e?(0,h.jsxs)(n.default,{dataSet:{ccwho:`tick-${t}`},style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center'},children:[(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:s}),(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:(0,h.jsx)(b,{rows:I,testIds:!1})})]}):(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,width:'max-content'},children:s})]})]})}if(t)return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:d.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:18,colour:d.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:d.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:d.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]);const f='undefined'!=typeof document,w=[18,24,32,40,50,64,80],u=`\n[data-testid="display-whos-on-top"]{overflow:hidden;max-width:100%;width:100%}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"] *{flex-wrap:nowrap!important;white-space:nowrap}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"]{display:inline-flex!important;flex-direction:row;align-items:center;width:max-content!important;max-width:none!important}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]>[data-ccwho],[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;width:max-content}\n${w.map(e=>`[data-testid="display-whos-on-top"] [data-ccwho="tick-${e}"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;animation:ccwho-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccwho-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{animation:none!important}}\n`;let p=!1;function x(){if(!f||p)return;p=!0;const e=document.createElement('style');e.setAttribute('data-ccwho-css','1'),e.textContent=u,document.head.appendChild(e)}const y=()=>f&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;function b({rows:e,testIds:t}){return(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',columnGap:10,flexShrink:0,width:'max-content'},children:e.map(e=>(0,h.jsxs)(n.default,{testID:t?`whos-on-shift-${e.staffId}`:void 0,accessible:t,accessibilityLabel:t?e.speech:void 0,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,numberOfLines:1,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,numberOfLines:1,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})}},1221,[35,237,103,1073,892,1222,822,795,26]); __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1222,[]); __d(function(g,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.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1223,[828,1042,35,403,103,795,1012,822,901,26]); __d(function(g,_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.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1224,[828,797,1225,1143,836,892,35,337,403,103,795,1012,1013,822,896,901,1226,1229,1231,26]); @@ -1426,7 +1426,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}},1343,[828,861,35,103,795,862,868,1168,1344,875,822,26]); __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})},1344,[904,958,1168]); __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]})}},1345,[31,35,873,1346,1416,26]); -__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=e(_r(_d[40])),G=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]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ye.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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:l?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:l?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),s?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.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||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ye.jsx)(Q.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${s.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ye.jsx)(Q.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ye.jsx)(Q.T,{size:12,colour:se.colours.muted,children:l}):null]})}function at({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,s));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:l?16:18,weight:"bold",children:[it(e)," \xb7 ",lt(e.customerName)]}),(0,Ye.jsx)(Q.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,Ye.jsxs)(Q.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,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,le.useRestaurant)(jt);(0,Re.useAlertWatcher)(jt,{enabled:!e});const kt=(0,le.useOrders)(jt),It=(0,le.useBookings)(jt),Dt=(0,le.useEvents)(jt),vt=(0,le.useStore)(e=>e.skipMinutes),St=(0,le.useStore)(e=>e.clock.mode),Ct=(0,le.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Rt=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,Ne.workingShifts)(Rt,Bt),[Rt,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Wt=(0,$.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:lt(Tt.find(e=>e.id===Wt)?.name)}),Ht=I.IS_CAR?'Car':'Display';(0,L.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,ne.useFrontDoor)(Pt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Ft=(0,re.useFloor)(e=>e.live[jt]),Gt=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,el]=(0,H.useState)(null),[tl,ll]=(0,H.useState)(null),[sl,il]=(0,H.useState)(!1),[ol,nl]=(0,H.useState)(!1),[al,rl]=(0,H.useState)(null),[dl,cl]=(0,H.useState)(!1),[ul,hl]=(0,H.useState)(!1),[gl,bl]=(0,H.useState)(!1),[yl,pl]=(0,H.useState)(null),[fl,xl]=(0,H.useState)(null),[ml,jl]=(0,H.useState)(null),[wl,kl]=(0,H.useState)(!1),Il=P.default.useRef(0),Dl=e=>{Il.current=Date.now(),jl(e)};P.default.useEffect(()=>{if(!ml)return;const e=setInterval(()=>{Date.now()-Il.current>=He.DAY_IDLE_MS&&jl(null)},5e3);return()=>clearInterval(e)},[ml]);const vl=(0,le.useWaitlist)(jt),Sl=(0,le.useStore)(e=>e.walkIns[jt]??0),[Cl,Tl]=(0,H.useState)(!1),[$l,Rl]=(0,H.useState)(!1),[Bl,Ll]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Wl,zl]=(0,H.useState)({view:0,content:0}),[Hl,Pl]=(0,H.useState)(null);P.default.useEffect(()=>{Hl&&((0,W.notify)({id:`floor-note:${Date.now()}`,title:Hl,timeoutMs:4500,big:!0,testID:'floor-toast'}),Pl(null))},[Hl]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Ml,Al]=(0,H.useState)(null),El=P.default.useRef(0),[Ol,Nl]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ml)return;El.current=Date.now();const e=setInterval(()=>{const e=Date.now()-El.current;if(e>=Xe)return Al(null),void Pl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nl(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ml]);const _l=e=>e.date!==Pt?ll({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!ci.ok,accessibilityHint:ci.hint,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ll({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ll(null),Pl(e)}}):null,e.walkIn?(0,Ye.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ll(null),Pl(e)}}):null,(0,Se.bookingDetails)(e)]})}),Fl=It.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),Gl=Fl.filter(e=>!['cancelled','noshow'].includes(e.status)),Vl=kt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ul=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),Kl=(0,Be.closedAreasAt)(Gt,jt,Pt,(0,te.hm)(Ct)),ql=[...Kl].join(','),Yl=(0,H.useMemo)(()=>(0,de.floorView)(_t,It,kt,Ft??{},Ct,wt.settings.turnMins,Kl),[_t,It,kt,Ft,Ct.getTime(),ql]),Ql=(0,ve.hoursFor)(wt,Ct),Jl=Ql?.open??new Date(`${Pt}T12:00:00`),Xl=Ql?.close??new Date(`${Pt}T21:00:00`),Zl=(0,te.addMins)(Jl,-Jl.getMinutes()),es=(0,te.addMins)(Xl,30),ts=e=>new Date(`${Pt}T${e}:00`),ls=(0,Be.blocksOn)(Gt,jt,Pt).map(e=>({from:ts(e.from),to:ts(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Pt)),ss=Object.keys(Yl).filter(e=>'blocked'===Yl[e]?.status),is=ml&&ml!==Pt?ml:Pt,os=is!==Pt,ns=(0,He.dayWord)(is,Pt),as=/^(Today|Yesterday|Tomorrow)$/.test(ns),rs=os?(0,He.bookingsForDay)(It,is,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Fl,ds=(0,te.parseYmd)(is);ds.setHours(12);const cs=os?(0,ve.hoursFor)(wt,ds):Ql,us=cs?.open??new Date(`${is}T12:00:00`),hs=cs?.close??new Date(`${is}T21:00:00`),gs=e=>new Date(`${is}T${e}:00`),bs=[...os?(0,Be.blocksOn)(Gt,jt,is).map(e=>({from:gs(e.from),to:gs(e.to),label:e.reason??'Paused'})):ls,...os?(0,o.queuedServicePauses)(wt,ds,is):[]],ys=(0,o.queuedServiceSessions)(wt,ds),ps=s.IS_QUEUED_VENUE&&(void 0===ys||!ys.length),fs=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ys?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),xs=os?cs||rs.length?isos?(0,de.dayFloorView)(_t,rs,is):Yl,[os,_t,rs,is,Yl]),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),[Ss,Cs]=(0,H.useState)(null),Ts=os?rs.filter(e=>!['cancelled','noshow'].includes(e.status)):Gl,$s=Ts.reduce((e,t)=>e+t.partySize,0),Rs=(0,u.coversSplit)(Ts,is),Bs=(0,Me.cancelledDayTally)(It,is),Ls=(0,Ae.cancellationsFor)(It,is,e=>e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Ws=(0,Me.cancelledTallyWords)(Bs,as?ns.toLowerCase():os?`on ${ns}`:'today'),zs=Gt.filter(e=>e.rid===jt&&e.date===is&&!e.removedAt),Hs=(0,ze.chartBands)(zs,60*us.getHours()+us.getMinutes(),60*hs.getHours()+hs.getMinutes()),Ps=new Set((0,ze.blockedHours)(Hs)),Ms=Ct.getHours()+(Ct.getMinutes()>=30?1:0),As=Ul.hours.filter(e=>e.hour>=Ms&&!Ps.has(e.hour)),Es=As.reduce((e,t)=>e+t.coversHigh,0),Os=As.reduce((e,t)=>e+t.coversLow,0),Ns=Math.round((Os+Es)/2),_s=!Ul.example&&Ul.open&&Ul.enough&&Es>0?`Usually ${(0,c.coversRange)(Ns,Ns)} more`:void 0,Fs=async(e,t)=>{const l=Yl[e]?.booking;if(!l||e===t)return;const s=Yl[t]?.status;if(s&&!['free','soon'].includes(s))return void Pl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Pl,{b:l,tables:[t]}))return;await le.repo.bookings.update(l.id,{table:t});const i=Ft?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Pl(`Saving: ${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(l.id,`${(0,xe.privName)(l,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}`,Pl)},Gs=e=>{if(fl)return Is(null),void xl(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);os?ws(e):Zt?(e!==Zt&&Fs(Zt,e),el(null)):Xt(e)},Vs=fl?It.find(e=>e.id===fl.id):void 0,Us=fl&&Vs?(()=>{const e=Vs.walkIn?(0,xe.privName)(Vs,Ot):lt(Vs.name),t=(0,De.seatsOf)(_t,fl.tables).total,l=(0,De.seatLine)(t,Vs.partySize),s=(0,De.pickClashes)(Vs,fl.tables,It.filter(e=>e.date===Vs.date),wt.settings.turnMins),i=(0,De.tableKey)(fl.tables)!==(0,De.tableKey)((0,re.tablesOf)(Vs.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(Vs.date,Pt)} ${Vs.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(fl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(Vs.date,Pt)," ",Vs.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:se.colours.text,children:[(0,De.tablesWords)(fl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ks?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ks,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ks})}):null,Ds&&Vs&&fl.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,fl.tables.join('+')),onYes:()=>{vs(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,l,e,t,Pl)})()},onNo:()=>vs(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:ks?'plan-pick-overcap-yes':'plan-pick-save',label:ks?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ks?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(fl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Vs)return void xl(null);if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=(0,De.overCapacityAsk)(fl.tables,t,Vs.partySize);if(l&&!ks)return void Is(l);if('finished'===Vs.status&&fl.tables.length&&!Ds)return void vs(!0);Is(null),vs(!1);const s=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,s,e,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Is(null),xl(null)}})]})]})})():null,Ks=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),qs=e=>{const t=_t.tables.filter(t=>t.areaId===e);return os?`${t.filter(e=>!ms[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Yl[e.name]?.status??'free')).length}/${t.length} free`},Ys='all'===Yt||Ks.some(e=>e.id===Yt)?Yt:'all',Qs=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:ms,privacy:Ot,turnBase:wt.settings.turnMins,highlight:fl?fl.tables:Zt?[Zt]:void 0,onTap:e=>Gs(e.name),onDrop:(e,t)=>fl||os?void 0:Fs(e.name,t.name)}),Js=ut?1:ht||Ks.length>2?2:1,Xs=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=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)/l},Zs=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ti=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:qs(e.id)})]}),li=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(l-xt.h)>1)&&mt({w:t,h:l})},children:ei?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:ei.scroll,showsVerticalScrollIndicator:ei.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:ei.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:ei.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=Ks.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ei.cellW,gap:2},children:[ti(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:Qs(e)})]},e)})},t))}):null}),si=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Ys,onPress:()=>Qt('all')},"__all"),...Ks.map(e=>(0,Ye.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ut?Kl.has(e.id)?'closed':Ys===e.id?qs(e.id):void 0:void 0,selected:Ys===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;zl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>zl(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:Wl.view>0&&Wl.content>0&&Wl.content<=Wl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Wl.view>0&&Wl.content<=Wl.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),Us,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>el(null)})]}):null,'all'===Ys&>?li:'all'===Ys?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:Zs.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>Xs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:qs(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:qs(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*Xs(e.id)))}:{flex:1},children:Qs(e.id)})]},e.id)),e.length{if(os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},is)}),oi='timeline'===Vt,ni=Kt?(0,Ye.jsx)(F.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${os?(0,He.dayLong)(is):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),ps?fs:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:os?rs:Fl,now:os?us:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:os?(0,te.addMins)(us,-us.getMinutes()):Zl,t1:os?(0,te.addMins)(hs,30):es,pauses:os?bs:ls,blockedTables:os?[]:ss,onOpen:e=>{if(qt(!1),os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},`full-${is}`)})]})}):null,ai=os?(0,Ye.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:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:as?`Showing ${ns} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(is))}`:`Showing ${(0,He.dayWord)(is,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ws}. Showing ${(0,He.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{xl(null),Dl(null)},style:{minHeight:44}})]}):null,ri=(0,Ye.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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(oi||Kt);return(0,Ye.jsx)(V.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.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,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),di='display'===I.APP_VARIANT&&!e?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ri,(0,Ye.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:Rt,staff:Tt,today:Pt,leave:Bt})]}):ri,ci=(0,h.useBookingWrite)(),ui=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>nl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint})]});(0,qe.useDisplayNotices)(jt,!e);const hi=ut?180:168,[gi,bi]=(0,H.useState)(hi),yi=P.default.useRef(hi),pi=P.default.useRef(null),fi=P.default.useRef(null),xi=()=>{const e=pi.current,t=fi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=ct<820?8:12,o=44+(ct<820?4:8),n=i>yi.current?Math.ceil(i-yi.current):We.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(hi,Math.floor(t-s-l)-n-o));Math.abs(yi.current-a)>=2&&(yi.current=a,bi(a))})})};P.default.useEffect(()=>{const e=setTimeout(xi,60);return()=>clearTimeout(e)},[rt,ct]);const mi=(0,Ye.jsxs)(K.default,{ref:fi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),xi()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Nl(null),Al({at:Date.now()})},onHint:()=>Pl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(Le.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:is}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(Le.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ll(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),ji=Vl.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:se.colours.muted,children:[Vl.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Vl,me:zt,compact:!0,bookings:It})})]}):null,wi=(Oe.DueToday,wt.settings.turnMins||90),ki=os?rs:(0,v.todaysGuestList)(Fl,Ct,wi),Ii=os?[]:(0,v.todaysFinishedList)(Fl,Ct,wi),Di=os?as?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',vi=(0,Ye.jsxs)(Ye.Fragment,{children:[0===ki.length?(0,Ye.jsx)(Q.Muted,{children:os?is{const t=(0,v.isLeftEarly)(e,Ct,wi),l=(0,ie.isSeatedHighlight)(e.status,{otherDay:os})&&!t,s=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=se.colours.text,o=l?se.colours.goldLight:se.colours.muted,n=se.colours.gold,a=s.depositWarn?se.colours.amber:se.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:os?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(_.AllergyIcon,{text:s.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,s.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ii.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ii.length}${gl?', expanded':', collapsed'}`,accessibilityState:{expanded:gl},onPress:()=>bl(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ii.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:se.colours.muted,children:gl?'\u25be':'\u25b8'})]}),gl?Ii.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:ci.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Ee.CancellationsSection,{items:Ls,dayWord:os?as?ns.toLowerCase():`on ${ns}`:'today'})]}),Si=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:vi}),Ci=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&hl(!1)}}),Ti=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Di}, ${ki.length}`,accessibilityState:{expanded:ul},'aria-expanded':ul,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:ul?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:ul?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:se.colours.gold,children:ki.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Di," ",ul?'\u2039':'\u203a']})})})]}),$i=ul?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...Ci.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Di.toUpperCase()," (",ki.length,")"]}),(0,Ye.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Di}`,onPress:()=>hl(!1),style:{marginRight:-6}})]}),Bs.count?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Ws}):null]}),Si]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Di}`,accessibilityRole:"button",onPress:()=>hl(!1),style:{flex:1}})]}):null,Ri=ps?fs:s.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:rs,open:us,close:hs,now:Ct,turnBase:wt.settings.turnMins,blocks:zs,pauses:bs,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:hi,forecastNote:os?void 0:_s,emptyText:xs,past:is{Il.current=Date.now(),kl(!0)},shortDay:!ut&&rt<1100}),Wi=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:wl,today:Pt,day:is,bookings:It,restaurant:wt,now:Ct,onDay:Dl,onClose:()=>kl(!1)}),zi=()=>{os?hl(!0):qt(!0)},Hi=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ct<820?8:12,paddingTop:ct<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[Mt?null:Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:ai,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):oi?ii:si,ni,$i]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ui(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:di}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:ct<820,snug:ct<820,tight:ct<700,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{ref:pi,testID:"day-graph-slot",onLayout:xi,style:{flexGrow:0,flexShrink:1,flexBasis:hi+52,minHeight:ct<=600?90:120,overflow:'visible'},children:Bi}),(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),ji,(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Il.current=Date.now()},onMouseDown:()=>{Il.current=Date.now()},children:[ut?(0,Ye.jsxs)(K.default,{style:{flex:1},children:[(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt}),Li,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(ot,{phone:!0,split:Rs,items:[{label:`Tables \xb7 ${ns}`,value:Ts.length,testID:'badge-tables'},{label:`Covers \xb7 ${ns}`,value:$s,testID:'badge-covers'},{label:'Takeaway',value:Vl.length,alert:Vl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>il(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ui(!0)}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),di,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[oi?ii:si,ni]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Di," (",ki.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{gap:4},children:vi})]}),ji,Bi,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),mi]}),e?null:(0,Ye.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:se.colours.hairline},children:(0,Ye.jsx)(N.VoiceSlot,{size:56})})]}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ct<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ye.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Li}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,Ye.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.muted,children:"?"})}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,e?null:(0,Ye.jsx)(j.ExitButton,{}),ee,Ue?null:(0,Ye.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,!I.IS_CAR&&Mt?(0,Ye.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(ot,{splitOnly:!0,split:Rs,items:[]})})]})}),gt?Hi:(Pi=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ui(!1)}),di]}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[ai,oi?ii:si,ni,$i]})]})}),ji,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:hi+We.DAY_GRAPH_CHROME},children:Bi})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Pi})),mi]}),(0,Ye.jsx)(R.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ll(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Bl,onClose:()=>Ll(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ol?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>nl(!1)}):null,al?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:al,who:zt,onClose:()=>rl(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Yl,plan:_t,todays:Fl,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>el(e),onDetails:_l}):null,js?(()=>{const e=ms[js],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Cs(null),ws(null)},title:`${(0,d.tableNumbersA11y)(js)} \xb7 ${as?ns:(0,He.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${as?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${as?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Ot):lt(e.name);return(0,Ye.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ws(null),pl(e.id)},style:{minHeight:56}},e.id)}),is>=Pt?(()=>{const t=e?.table.maxSeats??0,l=It.filter(e=>e.date===is&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(js)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(js)]}),Ss?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Ss.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Ss.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ci.ok,accessibilityHint:ci.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Ss.id);if(Cs(null),!e)return;const l=lt(e.name);ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Cs(null)})]})]}):null,Ss?null:l.slice(0,12).map(e=>{const l=lt(e.name),s=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ci.ok,accessibilityHint:ci.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(js)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:e,tables:[js]}))return;const s=(0,De.overCapacityAsk)([js],t,e.partySize);s?Cs({id:e.id,ask:s}):(ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Cs(null),ws(null)},style:{minHeight:56}})]})})():null,yl?(()=>{const e=It.find(e=>e.id===yl);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Ot):lt(e.name),view:Yl,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>pl(null),onDetails:_l,onDone:Pl,onEdit:e=>{pl(null),rl(e.id)},onPickOnPlan:(e,t)=>{hl(!1),Ut('plan'),Qt('all'),xl({id:e.id,tables:t})}}):null})():null,tl?(0,Ye.jsx)(Se.DetailsPanel,{title:tl.title,onClose:()=>ll(null),children:tl.body}):null,Wi,dl?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Fl,orders:kt,waitlistAll:vl,walkInCount:Sl,onClose:()=>cl(!1)}):null,Cl?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Tl(!1)})]}):null,$l?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Rl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Rl(!1)})]}):null,sl?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>il(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Vl,me:zt,bookings:It})]}):null,Ml?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{El.current=Date.now(),null!==Ol&&Nl(null)},notice:null!==Ol?`Locking again in ${Ol} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Al(null),Pl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Pl('Live seating plan updated on every screen.')},onCancel:()=>{Al(null),Pl('No changes kept. Editing is locked again.')}},Ml.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)($e.TakeawayTakeover,{rid:jt,me:zt})]});var Pi}function dt({rid:e,id:t,turnBase:l}){const s=(0,le.useBookings)(e).find(e=>e.id===t);return s?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); +__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,qe.jsx)(rt,{...e}):(0,qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Q.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]),o=_r(_d[4]),n=_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]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_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]),H=_r(_d[32]),z=_r(_d[33]),M=e(z),P=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_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])),Y=e(_r(_d[45])),q=_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]),oe=_r(_d[56]),ne=_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]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_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]),He=_r(_d[85]),ze=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_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]),Ye=_r(_d[99]),qe=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?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)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,qe.jsx)(Q.T,{size:s?14:12,colour:le.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)(M.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||o?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)(Q.T,{size:14,colour:le.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)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Q.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:le.colours.gold},children:[(0,qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){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:n?4:7,minHeight:44,paddingHorizontal:n?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:[o?(0,qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,qe.jsx)(Q.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.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:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,qe.jsx)(Q.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)(Q.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)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,Y.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=M.default.useRef(null),xt=M.default.useRef(0),[ft,mt]=(0,z.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const kt=(0,se.useOrders)(jt),It=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),Rt=(0,oe.useOwner)(e=>e.attendance),$t=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Wt=M.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);M.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Mt=(0,te.ymd)(Ct),Pt=(0,A.useTravelDay)('display',Mt),At=(0,ne.useFrontDoor)(Mt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,xe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,z.useState)('plan'),[Kt,Yt]=(0,z.useState)(!1),[qt,Qt]=(0,z.useState)('all'),[Jt,Xt]=(0,z.useState)(null),[Zt,es]=(0,z.useState)(null),[ts,ss]=(0,z.useState)(null),[ls,is]=(0,z.useState)(!1),[os,ns]=(0,z.useState)(!1),[as,rs]=(0,z.useState)(null),[ds,cs]=(0,z.useState)(!1),[us,hs]=(0,z.useState)(!1),[gs,bs]=(0,z.useState)(!1),[ys,ps]=(0,z.useState)(null),[xs,fs]=(0,z.useState)(null),[ms,js]=(0,z.useState)(null),[ws,ks]=(0,z.useState)(!1),Is=M.default.useRef(0),Ds=e=>{Is.current=Date.now(),js(e)};M.default.useEffect(()=>{if(!ms)return;const e=setInterval(()=>{Date.now()-Is.current>=ze.DAY_IDLE_MS&&js(null)},5e3);return()=>clearInterval(e)},[ms]);const vs=(0,se.useWaitlist)(jt),Ss=(0,se.useStore)(e=>e.walkIns[jt]??0),[Cs,Ts]=(0,z.useState)(!1),[Rs,$s]=(0,z.useState)(!1),[Bs,Ws]=(0,z.useState)(!1),[Ls,Hs]=(0,z.useState)(!1);(0,X.useReviewAlerts)(jt);const[zs,Ms]=(0,z.useState)({view:0,content:0}),[Ps,As]=(0,z.useState)(null);M.default.useEffect(()=>{Ps&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Ps,timeoutMs:4500,big:!0,testID:'floor-toast'}),As(null))},[Ps]),M.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Es,Os]=(0,z.useState)(null),Ns=M.default.useRef(0),[_s,Gs]=(0,z.useState)(null);M.default.useEffect(()=>{if(!Es)return;Ns.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Ns.current;if(e>=Xe)return Os(null),void As('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Gs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Fs=e=>e.date!==Mt?ss({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Mt)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!hi.ok,accessibilityHint:hi.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),As(e)}}):null,e.walkIn?(0,qe.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Mt,onDone:e=>{ss(null),As(e)}}):null,(0,Se.bookingDetails)(e)]})}),Vs=It.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Us=Vs.filter(e=>!['cancelled','noshow'].includes(e.status)),Ks=kt.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,z.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),qs=(0,Be.closedAreasAt)(Ft,jt,Mt,(0,te.hm)(Ct)),Qs=[...qs].join(','),Js=(0,z.useMemo)(()=>(0,de.floorView)(_t,It,kt,Gt??{},Ct,wt.settings.turnMins,qs),[_t,It,kt,Gt,Ct.getTime(),Qs]),Xs=(0,ve.hoursFor)(wt,Ct),Zs=Xs?.open??new Date(`${Mt}T12:00:00`),el=Xs?.close??new Date(`${Mt}T21:00:00`),tl=(0,te.addMins)(Zs,-Zs.getMinutes()),sl=(0,te.addMins)(el,30),ll=e=>new Date(`${Mt}T${e}:00`),il=(0,Be.blocksOn)(Ft,jt,Mt).map(e=>({from:ll(e.from),to:ll(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Mt)),ol=Object.keys(Js).filter(e=>'blocked'===Js[e]?.status),nl=ms&&ms!==Mt?ms:Mt,al=nl!==Mt,rl=(0,ze.dayWord)(nl,Mt),dl=/^(Today|Yesterday|Tomorrow)$/.test(rl),cl=al?(0,ze.bookingsForDay)(It,nl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):Vs,ul=(0,te.parseYmd)(nl);ul.setHours(12);const hl=al?(0,ve.hoursFor)(wt,ul):Xs,gl=hl?.open??new Date(`${nl}T12:00:00`),bl=hl?.close??new Date(`${nl}T21:00:00`),yl=e=>new Date(`${nl}T${e}:00`),pl=[...al?(0,Be.blocksOn)(Ft,jt,nl).map(e=>({from:yl(e.from),to:yl(e.to),label:e.reason??'Paused'})):il,...al?(0,o.queuedServicePauses)(wt,ul,nl):[]],xl=(0,o.queuedServiceSessions)(wt,ul),fl=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),ml=(0,qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),jl=al?hl||cl.length?nlal?(0,de.dayFloorView)(_t,cl,nl):Js,[al,_t,cl,nl,Js]),[kl,Il]=(0,z.useState)(null),[Dl,vl]=(0,z.useState)(null),[Sl,Cl]=(0,z.useState)(!1),[Tl,Rl]=(0,z.useState)(null),$l=al?cl.filter(e=>!['cancelled','noshow'].includes(e.status)):Us,Bl=$l.reduce((e,t)=>e+t.partySize,0),Wl=(0,u.coversSplit)($l,nl),Ll=(0,Pe.cancelledDayTally)(It,nl),Hl=(0,Ae.cancellationsFor)(It,nl,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),zl=(0,Pe.cancelledTallyWords)(Ll,dl?rl.toLowerCase():al?`on ${rl}`:'today'),Ml=Ft.filter(e=>e.rid===jt&&e.date===nl&&!e.removedAt),Pl=(0,He.chartBands)(Ml,60*gl.getHours()+gl.getMinutes(),60*bl.getHours()+bl.getMinutes()),Al=new Set((0,He.blockedHours)(Pl)),El=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Ol=Ys.hours.filter(e=>e.hour>=El&&!Al.has(e.hour)),Nl=Ol.reduce((e,t)=>e+t.coversHigh,0),_l=Ol.reduce((e,t)=>e+t.coversLow,0),Gl=Math.round((_l+Nl)/2),Fl=!Ys.example&&Ys.open&&Ys.enough&&Nl>0?`Usually ${(0,c.coversRange)(Gl,Gl)} more`:void 0,Vl=async(e,t)=>{const s=Js[e]?.booking;if(!s||e===t)return;const l=Js[t]?.status;if(l&&!['free','soon'].includes(l))return void As('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(As,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),As(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,As)},Ul=e=>{if(xs)return vl(null),void fs(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);al?Il(e):Zt?(e!==Zt&&Vl(Zt,e),es(null)):Xt(e)},Kl=xs?It.find(e=>e.id===xs.id):void 0,Yl=xs&&Kl?(()=>{const e=Kl.walkIn?(0,fe.privName)(Kl,Ot):st(Kl.name),t=(0,De.seatsOf)(_t,xs.tables).total,s=(0,De.seatLine)(t,Kl.partySize),l=(0,De.pickClashes)(Kl,xs.tables,It.filter(e=>e.date===Kl.date),wt.settings.turnMins),i=(0,De.tableKey)(xs.tables)!==(0,De.tableKey)((0,re.tablesOf)(Kl.table));return(0,qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Kl.date,Mt)} ${Kl.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Kl.date,Mt)," ",Kl.time]}),(0,qe.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Dl?(0,qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Dl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,qe.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Dl})}):null,Sl&&Kl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Cl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,s,e,t,As)})()},onNo:()=>Cl(!1)}):null,(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:Dl?'plan-pick-overcap-yes':'plan-pick-save',label:Dl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Dl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Kl)return void fs(null);if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=(0,De.overCapacityAsk)(xs.tables,t,Kl.partySize);if(s&&!Dl)return void vl(s);if('finished'===Kl.status&&xs.tables.length&&!Sl)return void Cl(!0);vl(null),Cl(!1);const l=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,l,e,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),fs(null)}})]})]})})():null,ql=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),Ql=e=>{const t=_t.tables.filter(t=>t.areaId===e);return al?`${t.filter(e=>!wl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Js[e.name]?.status??'free')).length}/${t.length} free`},Jl='all'===qt||ql.some(e=>e.id===qt)?qt:'all',Xl=e=>(0,qe.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:wl,privacy:Ot,turnBase:wt.settings.turnMins,highlight:xs?xs.tables:Zt?[Zt]:void 0,onTap:e=>Ul(e.name),onDrop:(e,t)=>xs||al?void 0:Vl(e.name,t.name)}),Zl=ut?1:ht||ql.length>2?2:1,ei=e=>{const t=_t.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},ti=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),ft.w,ft.h):null,li=e=>(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:Ql(e.id)})]}),ii=(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-ft.w)>1||Math.abs(s-ft.h)>1)&&mt({w:t,h:s})},children:si?(0,qe.jsx)(U.default,{style:{flex:1},scrollEnabled:si.scroll,showsVerticalScrollIndicator:si.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:si.rows.map((e,t)=>(0,qe.jsx)(K.default,{style:{height:si.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=ql.find(t=>t.id===e);return(0,qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:si.cellW,gap:2},children:[li(t),(0,qe.jsx)(K.default,{style:{flex:1},children:Xl(e)})]},e)})},t))}):null}),oi=(0,qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:_t}),_t.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)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Q.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)(Q.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)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Jl,onPress:()=>Qt('all')},"__all"),...ql.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?qs.has(e.id)?'closed':Jl===e.id?Ql(e.id):void 0:void 0,selected:Jl===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(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;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(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:zs.view>0&&zs.content>0&&zs.content<=zs.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:zs.view>0&&zs.content<=zs.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),Yl,Zt?(0,qe.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,qe.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===Jl&>?ii:'all'===Jl?(0,qe.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ti.map((e,t)=>(0,qe.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ei(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{center:!0,children:Ql(e.id)})]}):(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{children:Ql(e.id)})]}),(0,qe.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ei(e.id)))}:{flex:1},children:Xl(e.id)})]},e.id)),e.length{if(al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},nl)}),ai='timeline'===Vt,ri=Kt?(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:le.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:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.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)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${al?(0,ze.dayLong)(nl):'Today'}`})}),rt<600?null:(0,qe.jsx)(K.default,{style:{minWidth:180}})]}),fl?ml:(0,qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:al?cl:Vs,now:al?gl:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:al?(0,te.addMins)(gl,-gl.getMinutes()):tl,t1:al?(0,te.addMins)(bl,30):sl,pauses:al?pl:il,blockedTables:al?[]:ol,onOpen:e=>{if(Yt(!1),al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},`full-${nl}`)})]})}):null,di=al?(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:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:dl?`Showing ${rl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(nl))}`:`Showing ${(0,ze.dayWord)(nl,Mt)}`}),(0,qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${zl}. Showing ${(0,ze.dayLong)(nl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{fs(null),Ds(null)},style:{minHeight:44}})]}):null,ci=(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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(ai||Kt);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?(Ut('plan'),Yt(!0)):(Yt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.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)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ui='display'===I.APP_VARIANT&&!e?(0,qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ci,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:$t,staff:Tt,today:Mt,leave:Bt})]}):ci,hi=(0,h.useBookingWrite)(),gi=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint})]});(0,Ye.useDisplayNotices)(jt,!e);const bi=!e&&!I.IS_CAR&&!ut,yi=ut?180:202,[pi,xi]=(0,z.useState)(ut?180:168),fi=M.default.useRef(ut?180:168),mi=M.default.useRef(null),ji=M.default.useRef(null),wi=M.default.useRef(null),ki=!ut&&ct<=800,Ii=()=>{const e=mi.current,t=ji.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l)=>{const i=t>fi.current?Math.ceil(t-fi.current):0,o=Math.max(Le.DAY_GRAPH_CHROME+(ki?24:8),i),n=!ut&&ct>=700?140:70,a=Math.floor(s-4-e)-o-l,r=Math.min(yi,a>=n?Math.max(n,a):Math.max(0,a));Math.abs(fi.current-r)>=2&&(fi.current=r,xi(r))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,o,n,a)=>{t.measureInWindow((e,t)=>{const n=wi.current;bi&&n?.measureInWindow?n.measureInWindow((e,l,n,r)=>{const d=ct<820?4:8;s(o,a,t,Math.max(i,44+d+Math.round(r||0)))}):s(o,a,t,bi?i:l)})})};M.default.useEffect(()=>{const e=setTimeout(Ii,60);return()=>clearTimeout(e)},[rt,ct]);const Di=(0,qe.jsxs)(K.default,{ref:ji,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ii()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:ki?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ke.DisplayClockButton,{}),(0,qe.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Gs(null),Os({at:Date.now()})},onHint:()=>As('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:Ht,quiet:!0,display:!0,day:nl}),_t.areas.some(e=>e.outdoor)?(0,qe.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,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:()=>Hs(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(x.GiftQrButton,{rid:jt,venue:wt.name})]}),vi=Ks.length?(0,qe.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ks.length," live"]})]}),(0,qe.jsx)(K.default,{style:{padding:10},children:(0,qe.jsx)(at,{list:Ks,me:Ht,compact:!0,bookings:It})})]}):null,Si=(Oe.DueToday,wt.settings.turnMins||90),Ci=al?cl:(0,v.todaysGuestList)(Vs,Ct,Si),Ti=al?[]:(0,v.todaysFinishedList)(Vs,Ct,Si),Ri=al?dl?`${rl}\u2019s guests`:`Guests ${rl}`:'Today\u2019s guests',$i=(0,qe.jsxs)(qe.Fragment,{children:[0===Ci.length?(0,qe.jsx)(Q.Muted,{children:al?nl{const t=(0,v.isLeftEarly)(e,Ct,Si),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:al})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,o=s?le.colours.goldLight:le.colours.muted,n=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:al?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:l.time}),(0,qe.jsx)(Q.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)(_.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,qe.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?o:i,children:l.table}),l.dog?(0,qe.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ti.length?(0,qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ti.length}${gs?', expanded':', collapsed'}`,accessibilityState:{expanded:gs},onPress:()=>bs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",Ti.length,")"]}),(0,qe.jsx)(Q.T,{size:16,colour:le.colours.muted,children:gs?'\u25be':'\u25b8'})]}),gs?Ti.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(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:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Q.T,{size:15,colour:le.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:jt,today:Mt,who:t.name,allowed:hi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ee.CancellationsSection,{items:Hl,dayWord:al?dl?rl.toLowerCase():`on ${rl}`:'today'})]}),Bi=(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:$i}),Wi=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&&hs(!1)}}),Li=(0,qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ri}, ${Ci.length}`,accessibilityState:{expanded:us},'aria-expanded':us,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:Ci.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)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[Ri," ",us?'\u2039':'\u203a']})})})]}),Hi=us?(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",...Wi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.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,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Ri.toUpperCase()," (",Ci.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Ri}`,onPress:()=>hs(!1),style:{marginRight:-6}})]}),Ll.count?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:zl}):null]}),Bi]}),(0,qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ri}`,accessibilityRole:"button",onPress:()=>hs(!1),style:{flex:1}})]}):null,zi=fl?ml:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:cl,open:gl,close:bl,now:Ct,turnBase:wt.settings.turnMins,blocks:Ml,pauses:pl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?pi:yi,forecastNote:al?void 0:Fl,emptyText:jl,past:nl{Is.current=Date.now(),ks(!0)},shortDay:!ut&&rt<1100}),Ai=(0,qe.jsx)(Me.DisplayCalendar,{visible:ws,today:Mt,day:nl,bookings:It,restaurant:wt,now:Ct,onDay:Ds,onClose:()=>ks(!1)}),Ei=()=>{al?hs(!0):Yt(!0)},Oi=(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ki?4:ct<820?8:12,paddingTop:ki?bi?2:4:ct<820?bi?4:6:bi?8:10,gap:ki?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:di,Pt?(0,qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,today:Mt,app:"display"})}):ai?ni:oi,ri,Hi]}),(0,qe.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:gi(!1)}),(0,qe.jsx)(K.default,{style:{flexShrink:0},children:ui}),Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:ct<820,snug:ct<820,tight:ct<800,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{ref:mi,testID:"day-graph-slot",onLayout:Ii,style:{flexGrow:0,flexShrink:1,flexBasis:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),height:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),minHeight:ct<=600?90:Math.min((ut?yi:pi)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:Mi}),(0,qe.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[bi?null:(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),vi,(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht})]}),bi&&!Pt?(0,qe.jsx)(K.default,{ref:wi,testID:"display-side-split",style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})}):null]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{Is.current=Date.now()},onMouseDown:()=>{Is.current=Date.now()},children:[ut?(0,qe.jsxs)(K.default,{style:{flex:1},children:[(0,qe.jsxs)(U.default,{ref:pt,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)(Z.RestaurantLogo,{rid:jt,size:64}),(0,qe.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,qe.jsx)(Z.PoweredBy,{}),(0,qe.jsx)(H.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,qe.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:"m"}),(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt}),Pi,(0,qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(ot,{phone:!0,split:Wl,items:[{label:`Tables \xb7 ${rl}`,value:$l.length,testID:'badge-tables'},{label:`Covers \xb7 ${rl}`,value:Bl,testID:'badge-covers'},{label:'Takeaway',value:Ks.length,alert:Ks.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:gi(!0)}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),ui,(0,qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ai?ni:oi,ri]}),(0,qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[Ri," (",Ci.length,")"]}),(0,qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{gap:4},children:$i})]}),vi,Mi,(0,qe.jsx)(K.default,{testID:"covers-dock",children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.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)(Q.T,{center:!0,size:14,colour:Ot?le.colours.muted:le.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,qe.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Di]}),e?null:(0,qe.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:le.colours.hairline},children:(0,qe.jsx)(N.VoiceSlot,{size:56})})]}):(0,qe.jsxs)(qe.Fragment,{children:[bi?(0,qe.jsxs)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,n.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.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})}),(0,qe.jsx)(V.default,{testID:"display-more",accessibilityRole:"button",accessibilityLabel:"More",onPress:()=>Ws(!0),style:({pressed:e})=>({minWidth:44,height:44,marginLeft:8,paddingHorizontal:10,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center',flexShrink:0}),children:(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.muted,children:"More"})})]}):null,(0,qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ki?2:ct<820?4:8,gap:8,minHeight:ki&&bi?44:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,qe.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Pt?(0,qe.jsx)(K.default,{style:{width:220}}):(0,qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Pi}),(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:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Pt?null:(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,qe.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.muted,children:"?"})}),'simulated'===St?(0,qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,e?null:(0,qe.jsx)(j.ExitButton,{}),ee,Ue?null:(0,qe.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,I.IS_CAR||!Pt||bi?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Pt||bi?null:(0,qe.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,qe.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(K.default,{style:tt,children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})})]})}),gt?Oi:(Ni=(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:gi(!1)}),ui]}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),Pt?(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,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:[Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[di,ai?ni:oi,ri,Hi]})]})}),vi,Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:yi+Le.DAY_GRAPH_CHROME},children:Mi})]}),(0,qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Ni})),Di]}),(0,qe.jsx)($.SoldOutStrip,{rid:jt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:Ls,onClose:()=>Hs(!1),rid:jt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:jt}),At.elements,os?(0,qe.jsx)(y.EditBookingPicker,{rid:jt,today:Mt,who:Ht,onClose:()=>ns(!1)}):null,as?(0,qe.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:Ht,onClose:()=>rs(null)}):null,Jt?(0,qe.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Js,plan:_t,todays:Vs,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Fs}):null,kl?(()=>{const e=wl[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Rl(null),Il(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${dl?rl:(0,ze.dayLong)(nl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${dl?rl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${dl?rl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):st(e.name);return(0,qe.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Il(null),ps(e.id)},style:{minHeight:56}},e.id)}),nl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===nl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(kl)).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)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Tl?(0,qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Tl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Tl.ask}),(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!hi.ok,accessibilityHint:hi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Tl.id);if(Rl(null),!e)return;const s=st(e.name);Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Rl(null)})]})]}):null,Tl?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,qe.jsx)(Q.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:!hi.ok,accessibilityHint:hi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(As,{b:e,tables:[kl]}))return;const l=(0,De.overCapacityAsk)([kl],t,e.partySize);l?Rl({id:e.id,ask:l}):(Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Rl(null),Il(null)},style:{minHeight:56}})]})})():null,ys?(()=>{const e=It.find(e=>e.id===ys);return e?(0,qe.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):st(e.name),view:Js,now:Ct,otherDay:e.date!==Mt,turnBase:wt.settings.turnMins,onClose:()=>ps(null),onDetails:Fs,onDone:As,onEdit:e=>{ps(null),rs(e.id)},onPickOnPlan:(e,t)=>{hs(!1),Ut('plan'),Qt('all'),fs({id:e.id,tables:t})}}):null})():null,ts?(0,qe.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,Ai,ds?(0,qe.jsx)(Se.ServiceSummary,{r:wt,todays:Vs,orders:kt,waitlistAll:vs,walkInCount:Ss,onClose:()=>cs(!1)}):null,Cs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ts(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ts(!1)})]}):null,Bs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ws(!1),$s(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,Rs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,ls?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,qe.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(at,{list:Ks,me:Ht,bookings:It})]}):null,Es?(0,qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,qe.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Ns.current=Date.now(),null!==_s&&Gs(null)},notice:null!==_s?`Locking again in ${_s} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Os(null),As('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),As('Live seating plan updated on every screen.')},onCancel:()=>{Os(null),As('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,qe.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,qe.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,qe.jsx)(Re.TakeawayTakeover,{rid:jt,me:Ht})]});var Ni}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); __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},1348,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1349,[1005,1073]); @@ -1488,7 +1488,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";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}:{}}))}},1405,[]); __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)}},1406,[879,859,878]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1407,[5,1007,904,958]); -__d(function(g,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,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:w,blocks:M=[],height:v=150,forecastNote:k,emptyText:$,past:D,closed:A,compact:I=!1,dense:C=!1,bare:L=!1,fill:_=!1,fit:z=!1,tight:H=!1,live:O=!1}){const[S,F]=(0,t.useState)(0),[P,R]=(0,t.useState)(0),N=j.getTime()-18e5,B=T.getTime()+36e5,E=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(N),new Date(B),w),[e,N,B,w]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(M,W,X),[M,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=z&&P?Math.max(24,Math.floor(P)):Math.max(48,v-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=C?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:O,past:D,closed:A}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},he=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),de=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&de.push(t.getTime())}const ue=O?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),xe=A?null:O?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,ge=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:de,busiest:xe}):{hours:[],busiest:null},me=he(E),pe=le?he(ae.before):me,fe=le?he(ae.after):'',ye=_&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,we=ge.busiest?.text??(A?'':O?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),Me=U.map(e=>e.spoken).join('. '),ve=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${we?` ${we}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${ve} percent of the way through the day.`:''}${Me?` ${Me}.`:''}`,$e=(0,u.hm)(b),De=Math.max(44,12*$e.length*.7+16),Ae=Math.max(q+2,Math.min(Math.max(0,S-J-De),se(re)-De/2)),Ie=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,z?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:L?4:C?2:10,paddingBottom:L?2:6,backgroundColor:c.colours.bg}],children:[L?null:I?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),L||H?null:A?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ke,onLayout:e=>{F(e.nativeEvent.layout.width),z&&R(e.nativeEvent.layout.height)},style:z?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,v-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,A?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,ge.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:ge.busiest.x+ge.busiest.w/2,y:ge.busiest.y+ge.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:ge.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Ae,top:Ie,minWidth:De,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),ge.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':i(0,f.coverCurve)(e,new Date(N),new Date(B),v),[e,N,B,v]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(w,W,X),[w,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=O&&P?Math.max(24,Math.floor(P)):Math.max(48,M-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=A?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:$,closed:I}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},de=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),he=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&he.push(t.getTime())}const ue=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),ge=I?null:H?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,xe=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:he,busiest:ge}):{hours:[],busiest:null},me=de(E),pe=le?de(ae.before):me,fe=le?de(ae.after):'',ye=z&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ve=xe.busiest?.text??(I?'':H?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),we=U.map(e=>e.spoken).join('. '),Me=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=!I&&K&&K.covers?(0,m.peakOccupancyText)(K.t,K.covers):'',De=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${ke?` ${ke}.`:''}${ve?` ${ve}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${Me} percent of the way through the day.`:''}${we?` ${we}.`:''}`,$e=(0,u.hm)(b),Ie=Math.max(44,12*$e.length*.7+16),Le=Math.max(q+2,Math.min(Math.max(0,S-J-Ie),se(re)-Ie/2)),Ae=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[h.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:C?4:A?2:10,paddingBottom:C?2:6,backgroundColor:c.colours.bg}],children:[C?null:L?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te}),ke?(0,y.jsx)(d.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:ke}):null]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:A?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),C||_?null:I?k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),ke&&!L?(0,y.jsx)(d.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:ke}):k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),C||_||L||!k||!ke?null:(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),C||!_||!ke||L?null:(0,y.jsx)(d.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:ke}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:De,onLayout:e=>{F(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,xe.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:xe.busiest.x+xe.busiest.w/2,y:xe.busiest.y+xe.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:xe.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(d.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Le,top:Ae,minWidth:Ie,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(d.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),xe.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1409,[]); __d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1410,[1092]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1411,[861,1390]); diff --git a/chef-app/admin.html b/chef-app/admin.html index c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 d3aa57a6ebcd33b2ad83111dca0b55ca340ed724..690cc58542e5fcd828431a04daea402fe5483c83 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 099fbcdc5ea2b72213f9d8858160e1cb902d7c1a..116fce0813aeefb702fcbedf67962157f85d50ed 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-3d7894fc4a"; +const V = "cc-chef-3e3184e628"; 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=3d7894fc4a4c1231cf2d05f60276cdb28b13c984dedfec60df3f303c508c7c4d"]; +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=3e3184e628604cd14b4cd9420441f3a360f29434024f42877b80aeed6ff8a67d"]; // 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 c29eef9348439e2483097695fac20d4367ea78fa..7620e615fb504aee9fd81d3cef0bc07982f9617a 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 f3631f10ed5dd327c76b67e62ecf354c414ffb5d..e0ff727ed4d29b235e487d3177b616b21f77866c 100644 --- a/customer-app/_expo/static/js/web/bundle.js +++ b/customer-app/_expo/static/js/web/bundle.js @@ -5,7 +5,7 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() !(function(r){let l=0,n=!0===r.RN$useAlwaysAvailableJSErrorHandling?r.RN$handleException:(r,l)=>{throw r};const t={setGlobalHandler(r){n=r},getGlobalHandler:()=>n,reportError(r){n&&n(r,!1)},reportFatalError(r){n&&n(r,!0)},applyWithGuard(r,n,e,a,o){try{return l++,r.apply(n,e)}catch(r){t.reportError(r)}finally{l--}return null},applyWithGuardIfNeeded:(r,l,n)=>t.inGuard()?r.apply(l,n):(t.applyWithGuard(r,l,n),null),inGuard:()=>!!l,guard(r,l,n){if('function'!=typeof r)return console.warn('A function must be passed to ErrorUtils.guard, got ',r),null;const e=l??r.name??'';return function(...l){return t.applyWithGuard(r,n??this,l,null,e)}}};r.ErrorUtils=t})('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof global?global:'undefined'!=typeof window?window:this); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,20]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&!t.PITCH_ANCHORAGE&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=o=>{if(3===o.nodeType){const e=o.nodeValue??'',a=(0,n.pitchText)(e,t.PITCH_ANCHORAGE);return void(a!==e&&(o.nodeValue=a))}if(1!==o.nodeType)return;const a=o;if('INPUT'===a.tagName||'TEXTAREA'===a.tagName){const e=a,o=(0,n.pitchText)(e.value,t.PITCH_ANCHORAGE);o!==e.value&&(e.value=o);const i=e.getAttribute('placeholder');if(i){const o=(0,n.pitchText)(i,t.PITCH_ANCHORAGE);o!==i&&e.setAttribute('placeholder',o)}}for(const e of['aria-label','title']){const o=a.getAttribute(e);if(o){const i=(0,n.pitchText)(o,t.PITCH_ANCHORAGE);i!==o&&a.setAttribute(e,i)}}a.childNodes.forEach(e)},o=()=>{e(document.body),document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE),new MutationObserver(o=>{for(const t of o)'characterData'===t.type?e(t.target):t.addedNodes.forEach(e),'attributes'===t.type&&e(t.target);document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?o():document.addEventListener('DOMContentLoaded',o)}}},1,[2,3,16,18,19]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!0},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!1},2,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return c.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return R}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]);const u={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[6]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},h={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},f={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},b={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},p=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:f,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...u,orderAtTable:!1,pay:h,cashUpRecord:[...l.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:8,bookingNoticeMins:15,autoAcceptUpTo:8},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...u,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],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']},settings:{...u,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],A={by:'Fictional demo',at:'2026-10-26'},T=(t,n,o,s,c,l,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:c,price:l,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:A}),R=[T('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),T('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),T('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),T('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),T('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),T('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),T('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),T('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),T('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),T('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13,15]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="anchorage".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); @@ -1070,7 +1070,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()})},987,[35,988]); __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},988,[985,948,989]); __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'}},989,[985]); -__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.189'},990,[]); +__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.190'},990,[]); __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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},991,[992,993,904,948,988]); __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())}}}},993,[948]); @@ -1244,7 +1244,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 e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1161,[35,403,103,795,868,822,1154,1153,1158,1011,26]); __d(function(g,_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.ChefForecast=function({openPrep:e}){const{r:f,rid:y,now:b}=(0,u.useChef)(6e4),x=(0,l.useBookings)(y),p=(0,l.useOrders)(y),j=(0,l.useEvents)(y),k=(0,a.useRealHistory)(y,b),w=(0,d.ymd)(b),[T,$]=(0,o.useState)(7),{covers:v,enough:C,booked:D,pct:I,day:A,example:L}=(0,u.useForecast)(),M=0===I?`about a usual ${A}`:`${Math.abs(I)}% ${I>0?'busier':'quieter'} than a usual ${A}`,z=(0,o.useMemo)(()=>Array.from({length:T},(e,o)=>{const s=0===o?b:(0,d.addMins)((0,d.parseYmd)(w),1440*o),t=(0,i.forecastToday)(f,x,p,j,s,k??void 0);return{d:s,f:t,booked:t.hours.reduce((e,o)=>e+o.booked,0),covers:t.hours.reduce((e,o)=>e+o.covers,0)}}),[f,x,p,j,w,T,k,b.getTime()/6e5|0]),B=z[0].f,R=z.map(e=>({key:(0,d.ymd)(e.d),label:(0,d.dayShort)(e.d),spoken:(0,d.dayLong)(e.d),value:e.f.open?C?e.covers:e.booked:0,open:!!e.f.open}));return(0,h.jsxs)(t.default,{style:{gap:12},testID:"chef-forecast",children:[(0,h.jsx)(r.Muted,{center:!0,testID:"chef-forecast-busy",children:B.busy.words}),C?null:(0,h.jsx)(a.NotEnoughHistory,{weeks:B.minWeeks,booked:D}),(0,h.jsxs)(r.Card,{children:[(0,h.jsxs)(t.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,h.jsxs)(r.T,{center:!0,weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:[7===T?'This week':`Next ${T} days`," \xb7 ",C?'forecast covers':'booked covers']}),C?B.example?(0,h.jsx)(a.ExampleBadge,{}):(0,h.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"}):null]}),(0,h.jsx)(r.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,h.jsx)(r.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:T===e,onPress:()=>$(e),testID:`chef-forecast-range-${e}`},e))}),(0,h.jsx)(c.DaysLineGraph,{days:R,titleSpoken:`${C?'Forecast':'Booked'} covers for the next ${T} days`})]}),(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:"Covers per day"}),(0,h.jsxs)(t.default,{testID:"chef-forecast-days",children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',paddingVertical:6,borderBottomWidth:1,borderColor:n.colours.hairline},children:[(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{flex:1,textAlign:'left'},children:"Day"}),(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:72,textAlign:'right'},children:"Booked"}),C?(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:84,textAlign:'right'},children:"Forecast"}):null]}),z.map((e,o)=>{const s=0===o;return(0,h.jsxs)(t.default,{testID:`chef-forecast-day-${(0,d.ymd)(e.d)}`,accessible:!0,accessibilityLabel:e.f.open?`${(0,d.dayLong)(e.d)}: ${e.booked} booked${C?`, about ${e.covers} forecast`:''}`:`${(0,d.dayLong)(e.d)}: closed`,style:{flexDirection:'row',alignItems:'center',minHeight:40,borderBottomWidth:o({minHeight:48,borderRadius:12,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:e?n.colours.goldTint:'transparent'}),children:(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,children:"Open prep list \u203a"})})]})]})};var o=_r(_d[0]),s=e(_r(_d[1])),t=e(_r(_d[2])),r=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),d=_r(_d[6]),n=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11])},1162,[35,403,103,795,875,1155,859,822,1163,1159,1158,26]); __d(function(g,_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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1163,[829,35,284,365,237,103,427,798,795,828,822,1164,26]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,l=u,f=Math.max(10,i-s-l),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let M=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(p=n.busiest.t,s+(p-n.t0)/x*f-o/2);M={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var p;return{hours:b,busiest:M}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xf+(t-c)/M*b,w=l.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:p(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',f=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=l.indexOf(n);return t+(o<0?1e3:f[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.peakOccupancyText=function(t,n){const o=String(new Date(t).getHours()).padStart(2,'0');return`Peak ${n} ${1===n?'cover':'covers'} at ${o}:00`},e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,f=u,l=Math.max(10,i-s-f),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let p=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(M=n.busiest.t,s+(M-n.t0)/x*l-o/2);p={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var M;return{hours:b,busiest:p}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xl+(t-c)/p*b,w=f.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:M(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',l=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=f.indexOf(n);return t+(o<0?1e3:l[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); __d(function(g,_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.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,I.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,I.useForecast)(),f=(0,k.ymd)(i),p=(0,R.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),m=p.reduce((e,t)=>e+t.sold,0)||1,x=p.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/m)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),b={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{b[e.ing]=(b[e.ing]??0)+e.qty*t.qty}));const y=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini-fish-goujons','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,$.fmtQty)(Math.ceil(2*(b.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,$.fmtQty)(Math.ceil(10*(b.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,$.fmtQty)(Math.ceil(10*(b.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,$.fmtQty)(Math.ceil(2*(b.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,D.useKitchen)(e=>e.tickPrep),w=[...y.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=w.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,q.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,q.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} Covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,q.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} Covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," Covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,q.jsx)(u.Badge,{kind:S===w.length?'ok':'gold',label:`${S}/${w.length} done`})]}),w.map((t,i)=>{const n=e.prepTicks[t.key];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?C.colours.ok:C.colours.border,backgroundColor:C.colours.surface,marginTop:i===y.length?8:0},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:C.colours.muted}:void 0,children:t.text}),n?(0,q.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,q.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,I.useChef)(),a=(0,I.useWeek)(),d=(0,D.useKitchen)(e=>e.addWaste),[f,p]=(0,o.useState)(e.ingredients[0]?.id),[m,x]=(0,o.useState)(''),[b,y]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),k=Number(m.replace(',','.'))||0,S=k>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*k)),T=w&&S?(0,s.inputQuantity)(l,w,k):0,v=e.waste.filter(e=>(0,I.within7)(e.at,r));return w?(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,q.jsx)(I.Tile,{label:"Waste this week",value:(0,j.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,q.jsx)(I.Tile,{label:"Waste as % of food sales",value:a.sales?(0,I.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,q.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,q.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,q.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>p(e.id)},e.id))})}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:m,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:C.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),(0,q.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,q.jsx)(u.T,{weight:"semibold",colour:C.colours.gold,children:(0,j.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,q.jsxs)(u.Row,{children:[(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(k)-.5)))}),(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(k)+.5))}),(0,q.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:D.WASTE_REASONS.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===b,onPress:()=>y(e)},e))}),(0,q.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:b,cost:Math.round(T*w.cost)}),x('')}}),(0,q.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,q.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,q.jsx)(u.T,{size:14,children:(0,j.gbp)(e.cost)})]},e.id))]}):(0,q.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,I.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,b.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'},c=(0,m.useUnsignedDishes)(i),[x,j]=(0,o.useState)(!1);return x?(0,q.jsx)(m.UnsignedDishList,{rid:i,actor:a,onClose:()=>j(!1),onOpenCards:e}):(0,q.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,q.jsx)(d.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>j(!0),style:({pressed:e})=>({minHeight:48,opacity:e?.85:1}),children:(0,q.jsxs)(u.Card,{style:{alignItems:'center'},highlight:c.length?C.colours.amber:void 0,children:[(0,q.jsx)(u.Muted,{center:!0,children:"Dishes not signed off"}),(0,q.jsx)(u.T,{center:!0,size:20,weight:"bold",children:c.length})]})}),(0,q.jsx)(u.Muted,{children:"The 14 allergens from each recipe card. These are what guests see on the menu, takeaway and the booking allergy check. A red warning means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,q.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,l.map(({card:e,fromCosting:t})=>(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",center:!0,children:e.dish}),(0,q.jsx)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i,r='contains'===i?'Contains':'may'===i?'May contain':n?'In costing recipe, not on card':'Not listed';return(0,q.jsxs)(h.default,{accessible:!0,accessibilityLabel:`${e.dish}, ${s.label}: ${r}`,style:{flexGrow:1,flexBasis:220,minWidth:180,maxWidth:'100%',padding:8,borderRadius:8,backgroundColor:n?C.colours.redBg:C.colours.surface2},children:[(0,q.jsx)(u.T,{center:!0,size:14,weight:"semibold",children:s.label}),(0,q.jsx)(u.T,{center:!0,size:14,colour:n?C.colours.red:'contains'===i?C.colours.gold:C.colours.muted,children:r})]},s.id)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Not listed means the allergen is not recorded on this recipe card. Check any costing warnings before sign-off."}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,q.jsxs)(u.Card,{highlight:s.length?C.colours.red:C.colours.amber,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,q.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,q.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,q.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,p.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,q.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,q.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,I.useChef)(),l=(0,k.ymd)(i),a=(0,D.useKitchen)(e=>e.addTemp),c=(0,x.useOwner)(e=>e.checks),{tick:f,untick:p}=x.useOwner.getState(),[m,b]=(0,o.useState)('fridge'),y=E.find(e=>e.id===m),j={...y,units:y.units.filter(e=>(0,n.chefCanSee)(r,e))},[w,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,M=e.temps.filter(e=>e.at.slice(0,10)===l),B=(e,t,i)=>{const n=c[e];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?p(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,children:t}),(0,q.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:E.map(e=>(0,q.jsx)(u.Chip,{label:e.label,selected:e.id===m,onPress:()=>{b(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===w,onPress:()=>S(e)},e))}),(0,q.jsx)(u.Muted,{children:j.rule}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:C.colours.muted,style:{width:90,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),null===$?null:(0,q.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,q.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:m,unit:w,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,q.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",M.length,")"]}),M.length?M.map(e=>{const t=E.find(t=>t.id===e.kind)?.ok(e.temp);return(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,q.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,q.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?C.colours.ok:'warn'===t?C.colours.amber:C.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,q.jsx)(u.Muted,{children:"None yet today."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,q.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),G.map(e=>B(`${l}:kc-${e.id}`,e.text))]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),F.map(e=>B('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,I.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,v.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??I.CHEF_ID,role:'staff'}),[d?.id]),u=(0,T.useChatOpen)(e=>e.ch);return(0,o.useEffect)(()=>{u&&a('chat')},[u]),(0,q.jsx)(S.ChatAsCtx.Provider,{value:c,children:(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(H,{sub:r,setSub:a}),'live'===r?(0,q.jsx)(_,{}):'soldout'===r?(0,q.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,q.jsx)(V,{}):(0,q.jsx)(U,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),D=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),z=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]),N=_r(_d[36]),W=_r(_d[37]),q=_r(_d[38]);const E=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],F=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],G=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function H({sub:e,setSub:t}){const{total:s}=(0,S.useChatUnread)();return(0,q.jsx)(I.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function U(){return(0,q.jsx)(S.Chat,{go:()=>{}})}function _(){const{rid:e,r:t,me:s,now:i}=(0,I.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))),c=(e,t)=>!!(0,B.statusBlock)(e,t,(0,B.linkedBooking)(e,n)),p=(0,b.ticketView)('chef',d),m=(0,f.useStore)(e=>e.setOrderStatus),x=(0,f.useStore)(e=>e.ackReadiness),j=d.flatMap(e=>(0,w.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,q.jsxs)(h.default,{style:{gap:8},children:[j.length?(0,q.jsx)(u.Banner,{kind:"warn",title:`${j.length} readiness alert${j.length>1?'s':''}`,children:j.map(e=>e.detail).join(' \xb7 ')}):(0,q.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,q.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,p.length?p.map(e=>(0,q.jsxs)(u.Card,{highlight:e.allergies.length&&(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))&&'ready'!==e.status?C.colours.red:void 0,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`Table ${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,q.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,q.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,q.jsxs)(u.T,{size:13,colour:C.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,q.jsx)(M.AllergyChain,{o:e,me:s}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{m(e.id,'preparing',s),'takeaway'===e.type&&x(e.id,'cook',s)}}):null,'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>m(e.id,'ready',s)}):null]})]},e.id)):(0,q.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const K=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,k.ymd)(new Date(s,i-1,n+t))};function V(){const{now:e,today:t}={...(0,I.useChef)(6e4),today:(0,k.ymd)(new Date)},{staff:s,shifts:i}=(0,b.rotaView)('chef',(0,x.useOwner)(e=>e.staff),(0,x.useOwner)(e=>e.shifts)),n=(0,x.useOwner)(e=>e.leave),r=(0,N.canEditKitchenRota)((0,P.useSync)(e=>e.perms)),l=(0,x.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),a=(0,v.weekday)(e),o=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),d=(0,z.useSession)(e=>e.meId),c=(0,P.useSync)(e=>e.staffRef),f=d??c??I.CHEF_ID,p=(0,x.useOwner)(e=>e.staff.find(e=>e.id===f)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(L.BreakRoomCard,{staffId:f,name:p,now:e}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"On now"}),l.length?l.map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,q.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,q.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",v.DAY3[a],")"]}),i.filter(e=>e.date===t).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,W.leaveCovering)(n,e.staffId,e.date)?(0,q.jsx)(u.T,{size:13,colour:C.colours.blue,children:(0,W.leaveLabel)((0,W.leaveCovering)(n,e.staffId,e.date))}):(0,q.jsxs)(u.Muted,{children:[(0,v.fmtH)(e.start),"\u2013",(0,v.fmtH)(e.end)]})]},e.id))]}),r?(0,q.jsx)(u.Card,{children:(0,q.jsx)(A.KitchenRotaEditor,{today:t})}):(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),o.map(e=>(0,q.jsxs)(h.default,{style:{gap:4},children:[(0,q.jsx)(u.T,{size:14,children:e.name}),(0,q.jsx)(u.Row,{wrap:!0,gap:4,children:v.DAY3.map((s,n)=>{const r=i.find(s=>s.staffId===e.id&&s.date===K(t,n-a));return(0,q.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:r?C.colours.goldTint:C.colours.surface2,alignItems:'center'},children:[(0,q.jsx)(u.T,{size:10,colour:C.colours.muted,children:s}),(0,q.jsx)(u.T,{size:10,children:r?`${(0,v.fmtH)(r.start).slice(0,2)}\u2013${(0,v.fmtH)(r.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})]})}},1165,[828,955,1166,836,861,1167,1168,35,403,296,103,795,875,883,1169,892,966,862,868,1172,859,822,1173,1099,1073,1154,1153,1174,870,1158,1011,896,1175,977,958,1178,961,1087,26]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1166,[1153,955]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1167,[828,35,103,795,875,950,892,951,952,953,832,822,26]); @@ -1261,7 +1261,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";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=w,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,l.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,y.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,y.jsx)(w,{today:e}):(0,y.jsx)(I,{today:e})})},_e.KitchenRotaRead=I;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],j=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,k=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,p=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function w({today:e=(0,h.ymd)(new Date)}){const r=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,l.kitchenTeam)(r),[r]),$=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[w,I]=(0,t.useState)(0),S=(0,f.useDateCalendar)(),[v,C]=(0,t.useState)(null),[T,H]=(0,t.useState)(''),P=(0,a.addDays)((0,a.mondayOfDate)(e),7*w),L=(0,a.addDays)(P,6),R=b.map((e,t)=>(0,a.addDays)(P,t)),M=(0,l.kitchenPending)(o,$,P,L).length,O=e=>{H(e),(0,u.announce)(e)},W=0===w?'This week':1===w?'Next week':-1===w?'Last week':`Week of ${k(P)}`;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center',flexWrap:'nowrap'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(w-1),H('')},style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${W}, ${x[0]} ${k(P)} to ${x[6]} ${k(L)}`,style:{alignItems:'center',minWidth:120,flex:1},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:W}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(P)," \u2013 ",j(L)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(w+1),H('')},style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:S.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:S.calOpen,today:e,day:P,showBusy:!0,idPrefix:"krota-cal",onClose:S.closeCal,onDay:t=>{I((0,f.weekOffsetOf)(t??e,e)),H('')}}),d.map(t=>(0,y.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[p(t.nickname||t.name),t.job?(0,y.jsx)(n.T,{size:12,colour:m.colours.muted,children:` ${t.job}`}):null]}),(0,y.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:R.map((i,a)=>{const l=o.find(e=>e.staffId===t.id&&e.date===i),r=!(!l||l.published&&!l.changed),d=`${p(t.nickname||t.name)}, ${x[a]} ${k(i)}, ${l?`${(0,c.fmtH)(l.start)} to ${(0,c.fmtH)(l.end)}${r?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,y.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>C({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:r?'dashed':'solid',borderColor:l?r?m.colours.amber:m.colours.gold:m.colours.border,backgroundColor:e||l?m.colours.goldTint:m.colours.surface2}),children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:i===e?m.colours.gold:m.colours.muted,children:b[a]}),(0,y.jsx)(n.T,{size:10,center:!0,children:l?`${(0,c.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(l.end).slice(0,5)}):(0,y.jsx)(n.T,{size:10,center:!0,colour:m.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,y.jsx)(n.Button,{testID:"krota-publish",kind:M?'primary':'secondary',disabled:!M,label:M?`Publish kitchen rota (${M} ${1===M?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:M?`Publish the kitchen rota for ${W.toLowerCase()}, ${M} ${1===M?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,$,P,L);a.useOwner.getState().setShifts(e.shifts),O(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,y.jsx)(i.default,{testID:"krota-msg",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.goldLight,children:T})}):null,(0,y.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),v?(0,y.jsx)(D,{init:v,onClose:()=>C(null),onSaid:O}):null]})}function I({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:l}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,$]=(0,t.useState)(0),w=(0,f.useDateCalendar)(),I=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),D=(0,a.addDays)(I,6),S=b.map((e,t)=>(0,a.addDays)(I,t)),v=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),C=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${k(I)}`,[T,H]=(0,t.useState)(0),P=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>H(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>$(u-1),style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${C}, ${x[0]} ${k(I)} to ${x[6]} ${k(D)}`,style:{alignItems:'center',minWidth:120},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:C}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(I)," \u2013 ",j(D)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>$(u+1),style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:w.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:w.calOpen,today:e,day:I,showBusy:!0,idPrefix:"krota-read-cal",onClose:w.closeCal,onDay:t=>$((0,f.weekOffsetOf)(t??e,e))}),v.map(t=>(0,y.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:p(t.nickname||t.name)}),(0,y.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=l.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,r.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,r.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,y.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${p(t.nickname||t.name)}, ${x[a]} ${k(s)}, ${u}`,style:{width:P,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.goldTint:m.colours.surface2},children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:s===e?m.colours.gold:m.colours.muted,children:b[a]}),o&&h?(0,y.jsx)(n.T,{size:9,center:!0,colour:m.colours.blue,children:(0,r.leaveLabel)(h).toLowerCase()}):(0,y.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),v.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,y.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function D({init:e,onClose:s,onSaid:r}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=p(o?.nickname||o?.name||''),[u,f]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[j,w]=(0,t.useState)(!1),[I,D]=(0,t.useState)(''),S=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${k(e.date)})`;return(0,y.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${S}`,testID:"krota-sheet",children:(0,y.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,y.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{f(t),x(s)}},e))}),(0,y.jsx)(n.T,{center:!0,children:"Start"}),(0,y.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:f,format:c.fmtH,label:"Start time"}),(0,y.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,y.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,y.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),I?(0,y.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.amber,children:I})}):null,(0,y.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?D(`${d} already has a shift that overlaps on ${S}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),r(`${e.shift?'Changed':'Added'}: ${d}, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!j?(0,y.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&j?(0,y.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",S,"?"]}),(0,y.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),r(`Removed ${d}'s shift on ${S}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,y.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1178,[35,403,103,795,892,961,1087,966,958,1076,859,1111,1067,822,26]); __d(function(g,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.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1179,[1166,955,35,380,103,795,892,966,868,822,1073,1158,1011,1180,26]); __d(function(g,_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.openLink=w,_e.useSheetReminders=C,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=C(),f=(0,b.wd)(l);return(0,j.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,j.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,j.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,j.jsx)($,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,j.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]);function w(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function k(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const S={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},T={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function C(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function $({s:e,open:n,onToggle:o}){const{rid:C,r:$,me:D,now:I}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),M=(0,u.useOrderSheets)(e=>e.markOpened),B=(0,u.useOrderSheets)(t=>t.opened[e.id]),[L,P]=(0,s.useState)({}),[O,R]=(0,s.useState)(''),[A,z]=(0,s.useState)(''),[_,W]=(0,s.useState)(!1),H=(0,h.useShellfish)(C,D,'chef'),K=(0,b.nextDelivery)(e,I),E=(0,b.orderLines)(e,L,O,C),N=($.address??$.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=N.length>=3?N[1]:N[0]??'',U=(0,b.orderMessage)(e,$.name,q,E,D.split(' ')[0],I),Q=e.orderDays.includes((0,b.wd)(I)),Y=(e,t)=>P(n=>({...n,[e.id]:(0,l.stepQuantity)(C,e,n[e.id]||0,t)})),F=t=>{M(e.id,I.toISOString()),w(t)},G='text'===e.method||'whatsapp'===e.method||'phone'===e.method,V=Math.round(100*((0,y.parseMoneyInput)(A)??NaN)),J=H.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),X=J.filter(e=>H.isLow(e.key));return(0,j.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:Q||X.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,j.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[S[e.method]," ",e.name]}),(0,j.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,j.jsx)(i.Muted,{children:e.goods}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,j.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,j.jsx)(i.Badge,{kind:Q?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,j.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,j.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,J.length?(0,j.jsx)(i.Badge,{kind:X.length?'amber':'ok',label:J.map(e=>`${e.icon} ${(0,c.fmtStockCount)(C,e,H.counts[e.key]??0)}`).join(' \xb7 ')}):null,B&&new Date(B).toDateString()===I.toDateString()?(0,j.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,j.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[K?(0,j.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(K),"."]}):null,e.reminder?(0,j.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,j.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,j.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,j.jsxs)(d.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{children:[e.name,e.unit?(0,j.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(C,e),")"]}):null]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Y(e,-1),style:{minWidth:44,minHeight:44}}),(0,j.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(C,e,L[e.id]||0),children:(0,j.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(C,e)?(0,l.fishQtyText)(C,e,L[e.id]||0):L[e.id]||0})}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Y(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,j.jsx)(t.TextInput,{value:O,onChangeText:R,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[T,{minHeight:60}]})]}),G?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(C,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,'online'===e.method?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(C,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,e.priceCapPerKg?(0,j.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,j.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,j.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,j.jsx)(t.TextInput,{testID:"price-found",value:A,onChangeText:e=>z((0,y.sanitiseMoneyTyping)(e)),keyboardType:"decimal-pad",inputMode:"decimal",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[T,{width:120}]})]}),V>0?(0,j.jsx)(i.Badge,{kind:V<=e.priceCapPerKg?'ok':'red',label:V<=e.priceCapPerKg?`${(0,p.gbp)(V)}/kg is under the cap \u2713`:`${(0,p.gbp)(V)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,j.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,j.jsx)(i.T,{size:f.font.small,children:E.length?U:'Add quantities above to write the order.'})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!E.length,onPress:()=>F((0,b.smsLink)(e.number,U))}):null,'whatsapp'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!E.length,onPress:()=>F((0,b.waLink)(e.number,U))}):null,'phone'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>F((0,b.telLink)(e.number))}):null,'online'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>F(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&E.length?(0,j.jsx)(i.Button,{kind:"ghost",label:_?'Copied \u2713':'Copy order',onPress:async()=>{const e=await k(U);W(e),e&&setTimeout(()=>W(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,j.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,j.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1180,[828,836,955,35,380,237,403,103,795,1009,954,956,868,1010,822,1158,14,26]); -__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); +__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',justifyContent:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},1182,[5,823,824,829,237,827]); __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,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',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,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',w:64,h:45}}},1183,[]); __d(function(g,_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(', '))})]})}},1184,[828,1009,1166,955,35,403,103,795,892,868,822,1158,1011,14,26]); @@ -1295,7 +1295,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.AssignRoleSheet=function({name:e,when:s,current:u,onSave:b,onEditTimes:y,onClose:j}){const x={minHeight:o.IS_CAR?64:56,width:'100%'},_=(0,l.cleanBadge)(u);return(0,c.jsxs)(n.Sheet,{visible:!0,onClose:j,title:"Assign a role?",testID:"assign-role-sheet",maxWidth:560,children:[(0,c.jsx)(n.T,{size:18,center:!0,weight:"semibold",children:e}),(0,c.jsx)(n.Muted,{center:!0,children:s}),(0,c.jsxs)(t.default,{style:{gap:8,width:'100%'},children:[l.ROLE_BADGES.map(e=>(0,c.jsx)(n.Button,{kind:_===e?'primary':'secondary',label:e,testID:`assign-role-${h(e)}`,accessibilityLabel:`${e}${_===e?', chosen':''}`,onPress:()=>b(e),style:x},e)),(0,c.jsx)(n.Button,{kind:_?'secondary':'primary',label:"None",testID:"assign-role-none",accessibilityLabel:_?'None, clear the role badge':'None, chosen',onPress:()=>b(void 0),style:x}),y?(0,c.jsx)(n.Button,{kind:"ghost",label:"Edit shift times",testID:"assign-role-edit-times",onPress:y,style:x}):null]})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),o=r(d[4]),c=r(d[5]);const h=e=>e.replace(/\s+/g,'-').toLowerCase()},1212,[35,103,795,1211,873,26]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1213,[35,103,795,892,822,1073,1076,1209,1087,26]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1214,[35,103,1073,822,795,26]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),f=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),u=(0,n.useOwner)(e=>e.staff),x=(0,o.workingNow)(f,u,t),w=(0,o.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:r.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:r.colours.muted,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:r.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:r.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:r.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:r.colours.muted,center:!0,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:r.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:r.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),h=_r(d[7])},1215,[35,103,1073,892,1216,822,795,26]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:t=!1,marquee:s=!1}={}){const{today:u}=(0,o.useCtx)(15e3),p=(0,l.useOwner)(e=>(0,l.liveAttendance)(e.attendance)),j=(0,l.useOwner)(e=>e.staff),I=(0,r.workingNow)(p,j,u),D=(0,r.cardSpeech)(I),[k,v]=(0,e.useState)(0),[L,S]=(0,e.useState)(0),[W,O]=(0,e.useState)(y);if((0,e.useEffect)(()=>{t&&s&&x()},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'function'!=typeof window.matchMedia)return;const e=window.matchMedia('(prefers-reduced-motion: reduce)'),n=()=>O(!!e.matches);return n(),e.addEventListener?e.addEventListener('change',n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener('change',n):e.removeListener(n)}},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'undefined'==typeof ResizeObserver)return;const e=document.querySelector('[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]');if(!e)return;const n=()=>{const t=e.querySelector('[data-testid="whos-on-shift-list"]');v(e.clientWidth),t&&S(Math.max(t.scrollWidth,t.offsetWidth))},o=new ResizeObserver(n);o.observe(e);const l=e.querySelector('[data-testid="whos-on-shift-list"]');return l&&o.observe(l),n(),()=>o.disconnect()},[t,s,I.length,D]),t&&s){const e=k>0&&L>k+1&&f&&!W,t=w.find(e=>e>=Math.round((L+48)/32))??80,s=0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,numberOfLines:1,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",children:(0,h.jsx)(b,{rows:I,testIds:!0})});return(0,h.jsxs)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:0,paddingHorizontal:10,height:44,maxHeight:44,minHeight:44,overflow:'hidden',width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',gap:8},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",numberOfLines:1,style:{flexShrink:0},children:r.CARD_TITLE}),(0,h.jsxs)(n.default,{testID:"whos-on-shift-marquee",onLayout:e=>v(e.nativeEvent.layout.width),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,height:44,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:[(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",onLayout:e=>S(e.nativeEvent.layout.width),style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row',flexWrap:'nowrap',flexShrink:0,width:'max-content'},children:(0,h.jsx)(b,{rows:I,testIds:!1})}),e?(0,h.jsxs)(n.default,{dataSet:{ccwho:`tick-${t}`},style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center'},children:[(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:s}),(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:(0,h.jsx)(b,{rows:I,testIds:!1})})]}):(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,width:'max-content'},children:s})]})]})}if(t)return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:d.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:18,colour:d.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:d.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:d.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]);const f='undefined'!=typeof document,w=[18,24,32,40,50,64,80],u=`\n[data-testid="display-whos-on-top"]{overflow:hidden;max-width:100%;width:100%}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"] *{flex-wrap:nowrap!important;white-space:nowrap}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"]{display:inline-flex!important;flex-direction:row;align-items:center;width:max-content!important;max-width:none!important}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]>[data-ccwho],[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;width:max-content}\n${w.map(e=>`[data-testid="display-whos-on-top"] [data-ccwho="tick-${e}"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;animation:ccwho-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccwho-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{animation:none!important}}\n`;let p=!1;function x(){if(!f||p)return;p=!0;const e=document.createElement('style');e.setAttribute('data-ccwho-css','1'),e.textContent=u,document.head.appendChild(e)}const y=()=>f&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;function b({rows:e,testIds:t}){return(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',columnGap:10,flexShrink:0,width:'max-content'},children:e.map(e=>(0,h.jsxs)(n.default,{testID:t?`whos-on-shift-${e.staffId}`:void 0,accessible:t,accessibilityLabel:t?e.speech:void 0,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,numberOfLines:1,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,numberOfLines:1,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})}},1215,[35,237,103,1073,892,1216,822,795,26]); __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1216,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1217,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1218,[]); @@ -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,[828,861,35,103,795,862,868,1168,1332,875,822,26]); __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,[904,958,1168]); __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,[31,35,873,1334,1404,26]); -__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=e(_r(_d[40])),G=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]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ye.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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:l?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:l?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),s?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.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||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ye.jsx)(Q.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${s.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ye.jsx)(Q.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ye.jsx)(Q.T,{size:12,colour:se.colours.muted,children:l}):null]})}function at({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,s));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:l?16:18,weight:"bold",children:[it(e)," \xb7 ",lt(e.customerName)]}),(0,Ye.jsx)(Q.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,Ye.jsxs)(Q.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,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,le.useRestaurant)(jt);(0,Re.useAlertWatcher)(jt,{enabled:!e});const kt=(0,le.useOrders)(jt),It=(0,le.useBookings)(jt),Dt=(0,le.useEvents)(jt),vt=(0,le.useStore)(e=>e.skipMinutes),St=(0,le.useStore)(e=>e.clock.mode),Ct=(0,le.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Rt=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,Ne.workingShifts)(Rt,Bt),[Rt,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Wt=(0,$.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:lt(Tt.find(e=>e.id===Wt)?.name)}),Ht=I.IS_CAR?'Car':'Display';(0,L.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,ne.useFrontDoor)(Pt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Ft=(0,re.useFloor)(e=>e.live[jt]),Gt=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,el]=(0,H.useState)(null),[tl,ll]=(0,H.useState)(null),[sl,il]=(0,H.useState)(!1),[ol,nl]=(0,H.useState)(!1),[al,rl]=(0,H.useState)(null),[dl,cl]=(0,H.useState)(!1),[ul,hl]=(0,H.useState)(!1),[gl,bl]=(0,H.useState)(!1),[yl,pl]=(0,H.useState)(null),[fl,xl]=(0,H.useState)(null),[ml,jl]=(0,H.useState)(null),[wl,kl]=(0,H.useState)(!1),Il=P.default.useRef(0),Dl=e=>{Il.current=Date.now(),jl(e)};P.default.useEffect(()=>{if(!ml)return;const e=setInterval(()=>{Date.now()-Il.current>=He.DAY_IDLE_MS&&jl(null)},5e3);return()=>clearInterval(e)},[ml]);const vl=(0,le.useWaitlist)(jt),Sl=(0,le.useStore)(e=>e.walkIns[jt]??0),[Cl,Tl]=(0,H.useState)(!1),[$l,Rl]=(0,H.useState)(!1),[Bl,Ll]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Wl,zl]=(0,H.useState)({view:0,content:0}),[Hl,Pl]=(0,H.useState)(null);P.default.useEffect(()=>{Hl&&((0,W.notify)({id:`floor-note:${Date.now()}`,title:Hl,timeoutMs:4500,big:!0,testID:'floor-toast'}),Pl(null))},[Hl]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Ml,Al]=(0,H.useState)(null),El=P.default.useRef(0),[Ol,Nl]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ml)return;El.current=Date.now();const e=setInterval(()=>{const e=Date.now()-El.current;if(e>=Xe)return Al(null),void Pl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nl(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ml]);const _l=e=>e.date!==Pt?ll({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!ci.ok,accessibilityHint:ci.hint,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ll({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ll(null),Pl(e)}}):null,e.walkIn?(0,Ye.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ll(null),Pl(e)}}):null,(0,Se.bookingDetails)(e)]})}),Fl=It.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),Gl=Fl.filter(e=>!['cancelled','noshow'].includes(e.status)),Vl=kt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ul=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),Kl=(0,Be.closedAreasAt)(Gt,jt,Pt,(0,te.hm)(Ct)),ql=[...Kl].join(','),Yl=(0,H.useMemo)(()=>(0,de.floorView)(_t,It,kt,Ft??{},Ct,wt.settings.turnMins,Kl),[_t,It,kt,Ft,Ct.getTime(),ql]),Ql=(0,ve.hoursFor)(wt,Ct),Jl=Ql?.open??new Date(`${Pt}T12:00:00`),Xl=Ql?.close??new Date(`${Pt}T21:00:00`),Zl=(0,te.addMins)(Jl,-Jl.getMinutes()),es=(0,te.addMins)(Xl,30),ts=e=>new Date(`${Pt}T${e}:00`),ls=(0,Be.blocksOn)(Gt,jt,Pt).map(e=>({from:ts(e.from),to:ts(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Pt)),ss=Object.keys(Yl).filter(e=>'blocked'===Yl[e]?.status),is=ml&&ml!==Pt?ml:Pt,os=is!==Pt,ns=(0,He.dayWord)(is,Pt),as=/^(Today|Yesterday|Tomorrow)$/.test(ns),rs=os?(0,He.bookingsForDay)(It,is,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Fl,ds=(0,te.parseYmd)(is);ds.setHours(12);const cs=os?(0,ve.hoursFor)(wt,ds):Ql,us=cs?.open??new Date(`${is}T12:00:00`),hs=cs?.close??new Date(`${is}T21:00:00`),gs=e=>new Date(`${is}T${e}:00`),bs=[...os?(0,Be.blocksOn)(Gt,jt,is).map(e=>({from:gs(e.from),to:gs(e.to),label:e.reason??'Paused'})):ls,...os?(0,o.queuedServicePauses)(wt,ds,is):[]],ys=(0,o.queuedServiceSessions)(wt,ds),ps=s.IS_QUEUED_VENUE&&(void 0===ys||!ys.length),fs=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ys?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),xs=os?cs||rs.length?isos?(0,de.dayFloorView)(_t,rs,is):Yl,[os,_t,rs,is,Yl]),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),[Ss,Cs]=(0,H.useState)(null),Ts=os?rs.filter(e=>!['cancelled','noshow'].includes(e.status)):Gl,$s=Ts.reduce((e,t)=>e+t.partySize,0),Rs=(0,u.coversSplit)(Ts,is),Bs=(0,Me.cancelledDayTally)(It,is),Ls=(0,Ae.cancellationsFor)(It,is,e=>e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Ws=(0,Me.cancelledTallyWords)(Bs,as?ns.toLowerCase():os?`on ${ns}`:'today'),zs=Gt.filter(e=>e.rid===jt&&e.date===is&&!e.removedAt),Hs=(0,ze.chartBands)(zs,60*us.getHours()+us.getMinutes(),60*hs.getHours()+hs.getMinutes()),Ps=new Set((0,ze.blockedHours)(Hs)),Ms=Ct.getHours()+(Ct.getMinutes()>=30?1:0),As=Ul.hours.filter(e=>e.hour>=Ms&&!Ps.has(e.hour)),Es=As.reduce((e,t)=>e+t.coversHigh,0),Os=As.reduce((e,t)=>e+t.coversLow,0),Ns=Math.round((Os+Es)/2),_s=!Ul.example&&Ul.open&&Ul.enough&&Es>0?`Usually ${(0,c.coversRange)(Ns,Ns)} more`:void 0,Fs=async(e,t)=>{const l=Yl[e]?.booking;if(!l||e===t)return;const s=Yl[t]?.status;if(s&&!['free','soon'].includes(s))return void Pl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Pl,{b:l,tables:[t]}))return;await le.repo.bookings.update(l.id,{table:t});const i=Ft?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Pl(`Saving: ${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(l.id,`${(0,xe.privName)(l,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}`,Pl)},Gs=e=>{if(fl)return Is(null),void xl(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);os?ws(e):Zt?(e!==Zt&&Fs(Zt,e),el(null)):Xt(e)},Vs=fl?It.find(e=>e.id===fl.id):void 0,Us=fl&&Vs?(()=>{const e=Vs.walkIn?(0,xe.privName)(Vs,Ot):lt(Vs.name),t=(0,De.seatsOf)(_t,fl.tables).total,l=(0,De.seatLine)(t,Vs.partySize),s=(0,De.pickClashes)(Vs,fl.tables,It.filter(e=>e.date===Vs.date),wt.settings.turnMins),i=(0,De.tableKey)(fl.tables)!==(0,De.tableKey)((0,re.tablesOf)(Vs.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(Vs.date,Pt)} ${Vs.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(fl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(Vs.date,Pt)," ",Vs.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:se.colours.text,children:[(0,De.tablesWords)(fl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ks?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ks,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ks})}):null,Ds&&Vs&&fl.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,fl.tables.join('+')),onYes:()=>{vs(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,l,e,t,Pl)})()},onNo:()=>vs(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:ks?'plan-pick-overcap-yes':'plan-pick-save',label:ks?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ks?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(fl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Vs)return void xl(null);if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=(0,De.overCapacityAsk)(fl.tables,t,Vs.partySize);if(l&&!ks)return void Is(l);if('finished'===Vs.status&&fl.tables.length&&!Ds)return void vs(!0);Is(null),vs(!1);const s=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,s,e,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Is(null),xl(null)}})]})]})})():null,Ks=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),qs=e=>{const t=_t.tables.filter(t=>t.areaId===e);return os?`${t.filter(e=>!ms[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Yl[e.name]?.status??'free')).length}/${t.length} free`},Ys='all'===Yt||Ks.some(e=>e.id===Yt)?Yt:'all',Qs=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:ms,privacy:Ot,turnBase:wt.settings.turnMins,highlight:fl?fl.tables:Zt?[Zt]:void 0,onTap:e=>Gs(e.name),onDrop:(e,t)=>fl||os?void 0:Fs(e.name,t.name)}),Js=ut?1:ht||Ks.length>2?2:1,Xs=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=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)/l},Zs=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ti=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:qs(e.id)})]}),li=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(l-xt.h)>1)&&mt({w:t,h:l})},children:ei?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:ei.scroll,showsVerticalScrollIndicator:ei.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:ei.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:ei.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=Ks.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ei.cellW,gap:2},children:[ti(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:Qs(e)})]},e)})},t))}):null}),si=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Ys,onPress:()=>Qt('all')},"__all"),...Ks.map(e=>(0,Ye.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ut?Kl.has(e.id)?'closed':Ys===e.id?qs(e.id):void 0:void 0,selected:Ys===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;zl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>zl(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:Wl.view>0&&Wl.content>0&&Wl.content<=Wl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Wl.view>0&&Wl.content<=Wl.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),Us,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>el(null)})]}):null,'all'===Ys&>?li:'all'===Ys?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:Zs.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>Xs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:qs(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:qs(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*Xs(e.id)))}:{flex:1},children:Qs(e.id)})]},e.id)),e.length{if(os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},is)}),oi='timeline'===Vt,ni=Kt?(0,Ye.jsx)(F.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${os?(0,He.dayLong)(is):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),ps?fs:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:os?rs:Fl,now:os?us:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:os?(0,te.addMins)(us,-us.getMinutes()):Zl,t1:os?(0,te.addMins)(hs,30):es,pauses:os?bs:ls,blockedTables:os?[]:ss,onOpen:e=>{if(qt(!1),os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},`full-${is}`)})]})}):null,ai=os?(0,Ye.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:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:as?`Showing ${ns} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(is))}`:`Showing ${(0,He.dayWord)(is,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ws}. Showing ${(0,He.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{xl(null),Dl(null)},style:{minHeight:44}})]}):null,ri=(0,Ye.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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(oi||Kt);return(0,Ye.jsx)(V.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.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,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),di='display'===I.APP_VARIANT&&!e?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ri,(0,Ye.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:Rt,staff:Tt,today:Pt,leave:Bt})]}):ri,ci=(0,h.useBookingWrite)(),ui=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>nl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint})]});(0,qe.useDisplayNotices)(jt,!e);const hi=ut?180:168,[gi,bi]=(0,H.useState)(hi),yi=P.default.useRef(hi),pi=P.default.useRef(null),fi=P.default.useRef(null),xi=()=>{const e=pi.current,t=fi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=ct<820?8:12,o=44+(ct<820?4:8),n=i>yi.current?Math.ceil(i-yi.current):We.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(hi,Math.floor(t-s-l)-n-o));Math.abs(yi.current-a)>=2&&(yi.current=a,bi(a))})})};P.default.useEffect(()=>{const e=setTimeout(xi,60);return()=>clearTimeout(e)},[rt,ct]);const mi=(0,Ye.jsxs)(K.default,{ref:fi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),xi()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Nl(null),Al({at:Date.now()})},onHint:()=>Pl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(Le.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:is}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(Le.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ll(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),ji=Vl.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:se.colours.muted,children:[Vl.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Vl,me:zt,compact:!0,bookings:It})})]}):null,wi=(Oe.DueToday,wt.settings.turnMins||90),ki=os?rs:(0,v.todaysGuestList)(Fl,Ct,wi),Ii=os?[]:(0,v.todaysFinishedList)(Fl,Ct,wi),Di=os?as?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',vi=(0,Ye.jsxs)(Ye.Fragment,{children:[0===ki.length?(0,Ye.jsx)(Q.Muted,{children:os?is{const t=(0,v.isLeftEarly)(e,Ct,wi),l=(0,ie.isSeatedHighlight)(e.status,{otherDay:os})&&!t,s=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=se.colours.text,o=l?se.colours.goldLight:se.colours.muted,n=se.colours.gold,a=s.depositWarn?se.colours.amber:se.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:os?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(_.AllergyIcon,{text:s.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,s.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ii.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ii.length}${gl?', expanded':', collapsed'}`,accessibilityState:{expanded:gl},onPress:()=>bl(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ii.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:se.colours.muted,children:gl?'\u25be':'\u25b8'})]}),gl?Ii.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:ci.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Ee.CancellationsSection,{items:Ls,dayWord:os?as?ns.toLowerCase():`on ${ns}`:'today'})]}),Si=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:vi}),Ci=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&hl(!1)}}),Ti=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Di}, ${ki.length}`,accessibilityState:{expanded:ul},'aria-expanded':ul,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:ul?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:ul?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:se.colours.gold,children:ki.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Di," ",ul?'\u2039':'\u203a']})})})]}),$i=ul?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...Ci.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Di.toUpperCase()," (",ki.length,")"]}),(0,Ye.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Di}`,onPress:()=>hl(!1),style:{marginRight:-6}})]}),Bs.count?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Ws}):null]}),Si]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Di}`,accessibilityRole:"button",onPress:()=>hl(!1),style:{flex:1}})]}):null,Ri=ps?fs:s.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:rs,open:us,close:hs,now:Ct,turnBase:wt.settings.turnMins,blocks:zs,pauses:bs,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:hi,forecastNote:os?void 0:_s,emptyText:xs,past:is{Il.current=Date.now(),kl(!0)},shortDay:!ut&&rt<1100}),Wi=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:wl,today:Pt,day:is,bookings:It,restaurant:wt,now:Ct,onDay:Dl,onClose:()=>kl(!1)}),zi=()=>{os?hl(!0):qt(!0)},Hi=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ct<820?8:12,paddingTop:ct<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[Mt?null:Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:ai,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):oi?ii:si,ni,$i]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ui(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:di}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:ct<820,snug:ct<820,tight:ct<700,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{ref:pi,testID:"day-graph-slot",onLayout:xi,style:{flexGrow:0,flexShrink:1,flexBasis:hi+52,minHeight:ct<=600?90:120,overflow:'visible'},children:Bi}),(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),ji,(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Il.current=Date.now()},onMouseDown:()=>{Il.current=Date.now()},children:[ut?(0,Ye.jsxs)(K.default,{style:{flex:1},children:[(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt}),Li,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(ot,{phone:!0,split:Rs,items:[{label:`Tables \xb7 ${ns}`,value:Ts.length,testID:'badge-tables'},{label:`Covers \xb7 ${ns}`,value:$s,testID:'badge-covers'},{label:'Takeaway',value:Vl.length,alert:Vl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>il(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ui(!0)}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),di,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[oi?ii:si,ni]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Di," (",ki.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{gap:4},children:vi})]}),ji,Bi,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),mi]}),e?null:(0,Ye.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:se.colours.hairline},children:(0,Ye.jsx)(N.VoiceSlot,{size:56})})]}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ct<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ye.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Li}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,Ye.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.muted,children:"?"})}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,e?null:(0,Ye.jsx)(j.ExitButton,{}),ee,Ue?null:(0,Ye.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,!I.IS_CAR&&Mt?(0,Ye.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(ot,{splitOnly:!0,split:Rs,items:[]})})]})}),gt?Hi:(Pi=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ui(!1)}),di]}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[ai,oi?ii:si,ni,$i]})]})}),ji,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:hi+We.DAY_GRAPH_CHROME},children:Bi})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Pi})),mi]}),(0,Ye.jsx)(R.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ll(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Bl,onClose:()=>Ll(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ol?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>nl(!1)}):null,al?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:al,who:zt,onClose:()=>rl(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Yl,plan:_t,todays:Fl,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>el(e),onDetails:_l}):null,js?(()=>{const e=ms[js],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Cs(null),ws(null)},title:`${(0,d.tableNumbersA11y)(js)} \xb7 ${as?ns:(0,He.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${as?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${as?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Ot):lt(e.name);return(0,Ye.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ws(null),pl(e.id)},style:{minHeight:56}},e.id)}),is>=Pt?(()=>{const t=e?.table.maxSeats??0,l=It.filter(e=>e.date===is&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(js)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(js)]}),Ss?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Ss.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Ss.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ci.ok,accessibilityHint:ci.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Ss.id);if(Cs(null),!e)return;const l=lt(e.name);ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Cs(null)})]})]}):null,Ss?null:l.slice(0,12).map(e=>{const l=lt(e.name),s=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ci.ok,accessibilityHint:ci.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(js)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:e,tables:[js]}))return;const s=(0,De.overCapacityAsk)([js],t,e.partySize);s?Cs({id:e.id,ask:s}):(ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Cs(null),ws(null)},style:{minHeight:56}})]})})():null,yl?(()=>{const e=It.find(e=>e.id===yl);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Ot):lt(e.name),view:Yl,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>pl(null),onDetails:_l,onDone:Pl,onEdit:e=>{pl(null),rl(e.id)},onPickOnPlan:(e,t)=>{hl(!1),Ut('plan'),Qt('all'),xl({id:e.id,tables:t})}}):null})():null,tl?(0,Ye.jsx)(Se.DetailsPanel,{title:tl.title,onClose:()=>ll(null),children:tl.body}):null,Wi,dl?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Fl,orders:kt,waitlistAll:vl,walkInCount:Sl,onClose:()=>cl(!1)}):null,Cl?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Tl(!1)})]}):null,$l?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Rl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Rl(!1)})]}):null,sl?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>il(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Vl,me:zt,bookings:It})]}):null,Ml?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{El.current=Date.now(),null!==Ol&&Nl(null)},notice:null!==Ol?`Locking again in ${Ol} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Al(null),Pl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Pl('Live seating plan updated on every screen.')},onCancel:()=>{Al(null),Pl('No changes kept. Editing is locked again.')}},Ml.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)($e.TakeawayTakeover,{rid:jt,me:zt})]});var Pi}function dt({rid:e,id:t,turnBase:l}){const s=(0,le.useBookings)(e).find(e=>e.id===t);return s?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1334,[1069,797,5,6,1335,829,854,1108,861,1155,1336,1337,1338,1105,1135,1339,1340,1345,1346,1215,1347,873,1352,1353,1354,1128,1127,977,1355,1167,950,1118,1356,35,1088,1189,1027,1101,1151,1357,396,381,403,296,103,427,37,795,1231,1235,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1358,1122,1359,1366,1368,1371,1376,1370,1377,1379,1380,1130,1109,1110,879,1385,1220,1386,1230,1222,1004,1391,1396,1397,1070,1068,1132,1399,1400,1401,1087,1182,1402,1181,1174,870,1348,1403,26]); +__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,qe.jsx)(rt,{...e}):(0,qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Q.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]),o=_r(_d[4]),n=_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]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_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]),H=_r(_d[32]),z=_r(_d[33]),M=e(z),P=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_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])),Y=e(_r(_d[45])),q=_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]),oe=_r(_d[56]),ne=_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]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_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]),He=_r(_d[85]),ze=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_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]),Ye=_r(_d[99]),qe=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?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)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,qe.jsx)(Q.T,{size:s?14:12,colour:le.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)(M.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||o?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)(Q.T,{size:14,colour:le.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)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Q.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:le.colours.gold},children:[(0,qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){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:n?4:7,minHeight:44,paddingHorizontal:n?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:[o?(0,qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,qe.jsx)(Q.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.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:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,qe.jsx)(Q.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)(Q.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)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,Y.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=M.default.useRef(null),xt=M.default.useRef(0),[ft,mt]=(0,z.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const kt=(0,se.useOrders)(jt),It=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),Rt=(0,oe.useOwner)(e=>e.attendance),$t=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Wt=M.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);M.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Mt=(0,te.ymd)(Ct),Pt=(0,A.useTravelDay)('display',Mt),At=(0,ne.useFrontDoor)(Mt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,xe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,z.useState)('plan'),[Kt,Yt]=(0,z.useState)(!1),[qt,Qt]=(0,z.useState)('all'),[Jt,Xt]=(0,z.useState)(null),[Zt,es]=(0,z.useState)(null),[ts,ss]=(0,z.useState)(null),[ls,is]=(0,z.useState)(!1),[os,ns]=(0,z.useState)(!1),[as,rs]=(0,z.useState)(null),[ds,cs]=(0,z.useState)(!1),[us,hs]=(0,z.useState)(!1),[gs,bs]=(0,z.useState)(!1),[ys,ps]=(0,z.useState)(null),[xs,fs]=(0,z.useState)(null),[ms,js]=(0,z.useState)(null),[ws,ks]=(0,z.useState)(!1),Is=M.default.useRef(0),Ds=e=>{Is.current=Date.now(),js(e)};M.default.useEffect(()=>{if(!ms)return;const e=setInterval(()=>{Date.now()-Is.current>=ze.DAY_IDLE_MS&&js(null)},5e3);return()=>clearInterval(e)},[ms]);const vs=(0,se.useWaitlist)(jt),Ss=(0,se.useStore)(e=>e.walkIns[jt]??0),[Cs,Ts]=(0,z.useState)(!1),[Rs,$s]=(0,z.useState)(!1),[Bs,Ws]=(0,z.useState)(!1),[Ls,Hs]=(0,z.useState)(!1);(0,X.useReviewAlerts)(jt);const[zs,Ms]=(0,z.useState)({view:0,content:0}),[Ps,As]=(0,z.useState)(null);M.default.useEffect(()=>{Ps&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Ps,timeoutMs:4500,big:!0,testID:'floor-toast'}),As(null))},[Ps]),M.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Es,Os]=(0,z.useState)(null),Ns=M.default.useRef(0),[_s,Gs]=(0,z.useState)(null);M.default.useEffect(()=>{if(!Es)return;Ns.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Ns.current;if(e>=Xe)return Os(null),void As('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Gs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Fs=e=>e.date!==Mt?ss({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Mt)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!hi.ok,accessibilityHint:hi.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),As(e)}}):null,e.walkIn?(0,qe.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Mt,onDone:e=>{ss(null),As(e)}}):null,(0,Se.bookingDetails)(e)]})}),Vs=It.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Us=Vs.filter(e=>!['cancelled','noshow'].includes(e.status)),Ks=kt.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,z.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),qs=(0,Be.closedAreasAt)(Ft,jt,Mt,(0,te.hm)(Ct)),Qs=[...qs].join(','),Js=(0,z.useMemo)(()=>(0,de.floorView)(_t,It,kt,Gt??{},Ct,wt.settings.turnMins,qs),[_t,It,kt,Gt,Ct.getTime(),Qs]),Xs=(0,ve.hoursFor)(wt,Ct),Zs=Xs?.open??new Date(`${Mt}T12:00:00`),el=Xs?.close??new Date(`${Mt}T21:00:00`),tl=(0,te.addMins)(Zs,-Zs.getMinutes()),sl=(0,te.addMins)(el,30),ll=e=>new Date(`${Mt}T${e}:00`),il=(0,Be.blocksOn)(Ft,jt,Mt).map(e=>({from:ll(e.from),to:ll(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Mt)),ol=Object.keys(Js).filter(e=>'blocked'===Js[e]?.status),nl=ms&&ms!==Mt?ms:Mt,al=nl!==Mt,rl=(0,ze.dayWord)(nl,Mt),dl=/^(Today|Yesterday|Tomorrow)$/.test(rl),cl=al?(0,ze.bookingsForDay)(It,nl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):Vs,ul=(0,te.parseYmd)(nl);ul.setHours(12);const hl=al?(0,ve.hoursFor)(wt,ul):Xs,gl=hl?.open??new Date(`${nl}T12:00:00`),bl=hl?.close??new Date(`${nl}T21:00:00`),yl=e=>new Date(`${nl}T${e}:00`),pl=[...al?(0,Be.blocksOn)(Ft,jt,nl).map(e=>({from:yl(e.from),to:yl(e.to),label:e.reason??'Paused'})):il,...al?(0,o.queuedServicePauses)(wt,ul,nl):[]],xl=(0,o.queuedServiceSessions)(wt,ul),fl=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),ml=(0,qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),jl=al?hl||cl.length?nlal?(0,de.dayFloorView)(_t,cl,nl):Js,[al,_t,cl,nl,Js]),[kl,Il]=(0,z.useState)(null),[Dl,vl]=(0,z.useState)(null),[Sl,Cl]=(0,z.useState)(!1),[Tl,Rl]=(0,z.useState)(null),$l=al?cl.filter(e=>!['cancelled','noshow'].includes(e.status)):Us,Bl=$l.reduce((e,t)=>e+t.partySize,0),Wl=(0,u.coversSplit)($l,nl),Ll=(0,Pe.cancelledDayTally)(It,nl),Hl=(0,Ae.cancellationsFor)(It,nl,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),zl=(0,Pe.cancelledTallyWords)(Ll,dl?rl.toLowerCase():al?`on ${rl}`:'today'),Ml=Ft.filter(e=>e.rid===jt&&e.date===nl&&!e.removedAt),Pl=(0,He.chartBands)(Ml,60*gl.getHours()+gl.getMinutes(),60*bl.getHours()+bl.getMinutes()),Al=new Set((0,He.blockedHours)(Pl)),El=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Ol=Ys.hours.filter(e=>e.hour>=El&&!Al.has(e.hour)),Nl=Ol.reduce((e,t)=>e+t.coversHigh,0),_l=Ol.reduce((e,t)=>e+t.coversLow,0),Gl=Math.round((_l+Nl)/2),Fl=!Ys.example&&Ys.open&&Ys.enough&&Nl>0?`Usually ${(0,c.coversRange)(Gl,Gl)} more`:void 0,Vl=async(e,t)=>{const s=Js[e]?.booking;if(!s||e===t)return;const l=Js[t]?.status;if(l&&!['free','soon'].includes(l))return void As('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(As,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),As(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,As)},Ul=e=>{if(xs)return vl(null),void fs(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);al?Il(e):Zt?(e!==Zt&&Vl(Zt,e),es(null)):Xt(e)},Kl=xs?It.find(e=>e.id===xs.id):void 0,Yl=xs&&Kl?(()=>{const e=Kl.walkIn?(0,fe.privName)(Kl,Ot):st(Kl.name),t=(0,De.seatsOf)(_t,xs.tables).total,s=(0,De.seatLine)(t,Kl.partySize),l=(0,De.pickClashes)(Kl,xs.tables,It.filter(e=>e.date===Kl.date),wt.settings.turnMins),i=(0,De.tableKey)(xs.tables)!==(0,De.tableKey)((0,re.tablesOf)(Kl.table));return(0,qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Kl.date,Mt)} ${Kl.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Kl.date,Mt)," ",Kl.time]}),(0,qe.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Dl?(0,qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Dl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,qe.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Dl})}):null,Sl&&Kl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Cl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,s,e,t,As)})()},onNo:()=>Cl(!1)}):null,(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:Dl?'plan-pick-overcap-yes':'plan-pick-save',label:Dl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Dl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Kl)return void fs(null);if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=(0,De.overCapacityAsk)(xs.tables,t,Kl.partySize);if(s&&!Dl)return void vl(s);if('finished'===Kl.status&&xs.tables.length&&!Sl)return void Cl(!0);vl(null),Cl(!1);const l=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,l,e,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),fs(null)}})]})]})})():null,ql=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),Ql=e=>{const t=_t.tables.filter(t=>t.areaId===e);return al?`${t.filter(e=>!wl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Js[e.name]?.status??'free')).length}/${t.length} free`},Jl='all'===qt||ql.some(e=>e.id===qt)?qt:'all',Xl=e=>(0,qe.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:wl,privacy:Ot,turnBase:wt.settings.turnMins,highlight:xs?xs.tables:Zt?[Zt]:void 0,onTap:e=>Ul(e.name),onDrop:(e,t)=>xs||al?void 0:Vl(e.name,t.name)}),Zl=ut?1:ht||ql.length>2?2:1,ei=e=>{const t=_t.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},ti=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),ft.w,ft.h):null,li=e=>(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:Ql(e.id)})]}),ii=(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-ft.w)>1||Math.abs(s-ft.h)>1)&&mt({w:t,h:s})},children:si?(0,qe.jsx)(U.default,{style:{flex:1},scrollEnabled:si.scroll,showsVerticalScrollIndicator:si.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:si.rows.map((e,t)=>(0,qe.jsx)(K.default,{style:{height:si.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=ql.find(t=>t.id===e);return(0,qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:si.cellW,gap:2},children:[li(t),(0,qe.jsx)(K.default,{style:{flex:1},children:Xl(e)})]},e)})},t))}):null}),oi=(0,qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:_t}),_t.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)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Q.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)(Q.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)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Jl,onPress:()=>Qt('all')},"__all"),...ql.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?qs.has(e.id)?'closed':Jl===e.id?Ql(e.id):void 0:void 0,selected:Jl===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(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;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(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:zs.view>0&&zs.content>0&&zs.content<=zs.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:zs.view>0&&zs.content<=zs.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),Yl,Zt?(0,qe.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,qe.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===Jl&>?ii:'all'===Jl?(0,qe.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ti.map((e,t)=>(0,qe.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ei(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{center:!0,children:Ql(e.id)})]}):(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{children:Ql(e.id)})]}),(0,qe.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ei(e.id)))}:{flex:1},children:Xl(e.id)})]},e.id)),e.length{if(al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},nl)}),ai='timeline'===Vt,ri=Kt?(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:le.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:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.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)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${al?(0,ze.dayLong)(nl):'Today'}`})}),rt<600?null:(0,qe.jsx)(K.default,{style:{minWidth:180}})]}),fl?ml:(0,qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:al?cl:Vs,now:al?gl:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:al?(0,te.addMins)(gl,-gl.getMinutes()):tl,t1:al?(0,te.addMins)(bl,30):sl,pauses:al?pl:il,blockedTables:al?[]:ol,onOpen:e=>{if(Yt(!1),al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},`full-${nl}`)})]})}):null,di=al?(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:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:dl?`Showing ${rl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(nl))}`:`Showing ${(0,ze.dayWord)(nl,Mt)}`}),(0,qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${zl}. Showing ${(0,ze.dayLong)(nl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{fs(null),Ds(null)},style:{minHeight:44}})]}):null,ci=(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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(ai||Kt);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?(Ut('plan'),Yt(!0)):(Yt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.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)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ui='display'===I.APP_VARIANT&&!e?(0,qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ci,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:$t,staff:Tt,today:Mt,leave:Bt})]}):ci,hi=(0,h.useBookingWrite)(),gi=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint})]});(0,Ye.useDisplayNotices)(jt,!e);const bi=!e&&!I.IS_CAR&&!ut,yi=ut?180:202,[pi,xi]=(0,z.useState)(ut?180:168),fi=M.default.useRef(ut?180:168),mi=M.default.useRef(null),ji=M.default.useRef(null),wi=M.default.useRef(null),ki=!ut&&ct<=800,Ii=()=>{const e=mi.current,t=ji.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l)=>{const i=t>fi.current?Math.ceil(t-fi.current):0,o=Math.max(Le.DAY_GRAPH_CHROME+(ki?24:8),i),n=!ut&&ct>=700?140:70,a=Math.floor(s-4-e)-o-l,r=Math.min(yi,a>=n?Math.max(n,a):Math.max(0,a));Math.abs(fi.current-r)>=2&&(fi.current=r,xi(r))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,o,n,a)=>{t.measureInWindow((e,t)=>{const n=wi.current;bi&&n?.measureInWindow?n.measureInWindow((e,l,n,r)=>{const d=ct<820?4:8;s(o,a,t,Math.max(i,44+d+Math.round(r||0)))}):s(o,a,t,bi?i:l)})})};M.default.useEffect(()=>{const e=setTimeout(Ii,60);return()=>clearTimeout(e)},[rt,ct]);const Di=(0,qe.jsxs)(K.default,{ref:ji,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ii()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:ki?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ke.DisplayClockButton,{}),(0,qe.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Gs(null),Os({at:Date.now()})},onHint:()=>As('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:Ht,quiet:!0,display:!0,day:nl}),_t.areas.some(e=>e.outdoor)?(0,qe.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,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:()=>Hs(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(x.GiftQrButton,{rid:jt,venue:wt.name})]}),vi=Ks.length?(0,qe.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ks.length," live"]})]}),(0,qe.jsx)(K.default,{style:{padding:10},children:(0,qe.jsx)(at,{list:Ks,me:Ht,compact:!0,bookings:It})})]}):null,Si=(Oe.DueToday,wt.settings.turnMins||90),Ci=al?cl:(0,v.todaysGuestList)(Vs,Ct,Si),Ti=al?[]:(0,v.todaysFinishedList)(Vs,Ct,Si),Ri=al?dl?`${rl}\u2019s guests`:`Guests ${rl}`:'Today\u2019s guests',$i=(0,qe.jsxs)(qe.Fragment,{children:[0===Ci.length?(0,qe.jsx)(Q.Muted,{children:al?nl{const t=(0,v.isLeftEarly)(e,Ct,Si),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:al})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,o=s?le.colours.goldLight:le.colours.muted,n=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:al?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:l.time}),(0,qe.jsx)(Q.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)(_.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,qe.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?o:i,children:l.table}),l.dog?(0,qe.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ti.length?(0,qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ti.length}${gs?', expanded':', collapsed'}`,accessibilityState:{expanded:gs},onPress:()=>bs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",Ti.length,")"]}),(0,qe.jsx)(Q.T,{size:16,colour:le.colours.muted,children:gs?'\u25be':'\u25b8'})]}),gs?Ti.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(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:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Q.T,{size:15,colour:le.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:jt,today:Mt,who:t.name,allowed:hi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ee.CancellationsSection,{items:Hl,dayWord:al?dl?rl.toLowerCase():`on ${rl}`:'today'})]}),Bi=(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:$i}),Wi=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&&hs(!1)}}),Li=(0,qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ri}, ${Ci.length}`,accessibilityState:{expanded:us},'aria-expanded':us,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:Ci.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)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[Ri," ",us?'\u2039':'\u203a']})})})]}),Hi=us?(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",...Wi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.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,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Ri.toUpperCase()," (",Ci.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Ri}`,onPress:()=>hs(!1),style:{marginRight:-6}})]}),Ll.count?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:zl}):null]}),Bi]}),(0,qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ri}`,accessibilityRole:"button",onPress:()=>hs(!1),style:{flex:1}})]}):null,zi=fl?ml:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:cl,open:gl,close:bl,now:Ct,turnBase:wt.settings.turnMins,blocks:Ml,pauses:pl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?pi:yi,forecastNote:al?void 0:Fl,emptyText:jl,past:nl{Is.current=Date.now(),ks(!0)},shortDay:!ut&&rt<1100}),Ai=(0,qe.jsx)(Me.DisplayCalendar,{visible:ws,today:Mt,day:nl,bookings:It,restaurant:wt,now:Ct,onDay:Ds,onClose:()=>ks(!1)}),Ei=()=>{al?hs(!0):Yt(!0)},Oi=(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ki?4:ct<820?8:12,paddingTop:ki?bi?2:4:ct<820?bi?4:6:bi?8:10,gap:ki?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:di,Pt?(0,qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,today:Mt,app:"display"})}):ai?ni:oi,ri,Hi]}),(0,qe.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:gi(!1)}),(0,qe.jsx)(K.default,{style:{flexShrink:0},children:ui}),Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:ct<820,snug:ct<820,tight:ct<800,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{ref:mi,testID:"day-graph-slot",onLayout:Ii,style:{flexGrow:0,flexShrink:1,flexBasis:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),height:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),minHeight:ct<=600?90:Math.min((ut?yi:pi)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:Mi}),(0,qe.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[bi?null:(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),vi,(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht})]}),bi&&!Pt?(0,qe.jsx)(K.default,{ref:wi,testID:"display-side-split",style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})}):null]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{Is.current=Date.now()},onMouseDown:()=>{Is.current=Date.now()},children:[ut?(0,qe.jsxs)(K.default,{style:{flex:1},children:[(0,qe.jsxs)(U.default,{ref:pt,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)(Z.RestaurantLogo,{rid:jt,size:64}),(0,qe.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,qe.jsx)(Z.PoweredBy,{}),(0,qe.jsx)(H.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,qe.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:"m"}),(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt}),Pi,(0,qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(ot,{phone:!0,split:Wl,items:[{label:`Tables \xb7 ${rl}`,value:$l.length,testID:'badge-tables'},{label:`Covers \xb7 ${rl}`,value:Bl,testID:'badge-covers'},{label:'Takeaway',value:Ks.length,alert:Ks.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:gi(!0)}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),ui,(0,qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ai?ni:oi,ri]}),(0,qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[Ri," (",Ci.length,")"]}),(0,qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{gap:4},children:$i})]}),vi,Mi,(0,qe.jsx)(K.default,{testID:"covers-dock",children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.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)(Q.T,{center:!0,size:14,colour:Ot?le.colours.muted:le.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,qe.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Di]}),e?null:(0,qe.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:le.colours.hairline},children:(0,qe.jsx)(N.VoiceSlot,{size:56})})]}):(0,qe.jsxs)(qe.Fragment,{children:[bi?(0,qe.jsxs)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,n.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.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})}),(0,qe.jsx)(V.default,{testID:"display-more",accessibilityRole:"button",accessibilityLabel:"More",onPress:()=>Ws(!0),style:({pressed:e})=>({minWidth:44,height:44,marginLeft:8,paddingHorizontal:10,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center',flexShrink:0}),children:(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.muted,children:"More"})})]}):null,(0,qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ki?2:ct<820?4:8,gap:8,minHeight:ki&&bi?44:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,qe.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Pt?(0,qe.jsx)(K.default,{style:{width:220}}):(0,qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Pi}),(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:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Pt?null:(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,qe.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.muted,children:"?"})}),'simulated'===St?(0,qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,e?null:(0,qe.jsx)(j.ExitButton,{}),ee,Ue?null:(0,qe.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,I.IS_CAR||!Pt||bi?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Pt||bi?null:(0,qe.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,qe.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(K.default,{style:tt,children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})})]})}),gt?Oi:(Ni=(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:gi(!1)}),ui]}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),Pt?(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,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:[Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[di,ai?ni:oi,ri,Hi]})]})}),vi,Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:yi+Le.DAY_GRAPH_CHROME},children:Mi})]}),(0,qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Ni})),Di]}),(0,qe.jsx)($.SoldOutStrip,{rid:jt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:Ls,onClose:()=>Hs(!1),rid:jt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:jt}),At.elements,os?(0,qe.jsx)(y.EditBookingPicker,{rid:jt,today:Mt,who:Ht,onClose:()=>ns(!1)}):null,as?(0,qe.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:Ht,onClose:()=>rs(null)}):null,Jt?(0,qe.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Js,plan:_t,todays:Vs,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Fs}):null,kl?(()=>{const e=wl[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Rl(null),Il(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${dl?rl:(0,ze.dayLong)(nl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${dl?rl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${dl?rl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):st(e.name);return(0,qe.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Il(null),ps(e.id)},style:{minHeight:56}},e.id)}),nl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===nl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(kl)).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)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Tl?(0,qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Tl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Tl.ask}),(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!hi.ok,accessibilityHint:hi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Tl.id);if(Rl(null),!e)return;const s=st(e.name);Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Rl(null)})]})]}):null,Tl?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,qe.jsx)(Q.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:!hi.ok,accessibilityHint:hi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(As,{b:e,tables:[kl]}))return;const l=(0,De.overCapacityAsk)([kl],t,e.partySize);l?Rl({id:e.id,ask:l}):(Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Rl(null),Il(null)},style:{minHeight:56}})]})})():null,ys?(()=>{const e=It.find(e=>e.id===ys);return e?(0,qe.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):st(e.name),view:Js,now:Ct,otherDay:e.date!==Mt,turnBase:wt.settings.turnMins,onClose:()=>ps(null),onDetails:Fs,onDone:As,onEdit:e=>{ps(null),rs(e.id)},onPickOnPlan:(e,t)=>{hs(!1),Ut('plan'),Qt('all'),fs({id:e.id,tables:t})}}):null})():null,ts?(0,qe.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,Ai,ds?(0,qe.jsx)(Se.ServiceSummary,{r:wt,todays:Vs,orders:kt,waitlistAll:vs,walkInCount:Ss,onClose:()=>cs(!1)}):null,Cs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ts(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ts(!1)})]}):null,Bs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ws(!1),$s(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,Rs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,ls?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,qe.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(at,{list:Ks,me:Ht,bookings:It})]}):null,Es?(0,qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,qe.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Ns.current=Date.now(),null!==_s&&Gs(null)},notice:null!==_s?`Locking again in ${_s} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Os(null),As('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),As('Live seating plan updated on every screen.')},onCancel:()=>{Os(null),As('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,qe.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,qe.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,qe.jsx)(Re.TakeawayTakeover,{rid:jt,me:Ht})]});var Ni}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1334,[1069,797,5,6,1335,829,854,1108,861,1155,1336,1337,1338,1105,1135,1339,1340,1345,1346,1215,1347,873,1352,1353,1354,1128,1127,977,1355,1167,950,1118,1356,35,1088,1189,1027,1101,1151,1357,396,381,403,296,103,427,37,795,1231,1235,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1358,1122,1359,1366,1368,1371,1376,1370,1377,1379,1380,1130,1109,1110,879,1385,1220,1386,1230,1222,1004,1391,1396,1397,1070,1068,1132,1399,1400,1401,1087,1182,1402,1181,1174,870,1348,1403,26]); __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},1336,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1337,[1005,1073]); @@ -1476,7 +1476,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";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}:{}}))}},1393,[]); __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)}},1394,[879,859,878]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1395,[5,1007,904,958]); -__d(function(g,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,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:w,blocks:M=[],height:v=150,forecastNote:k,emptyText:$,past:D,closed:A,compact:I=!1,dense:C=!1,bare:L=!1,fill:_=!1,fit:z=!1,tight:H=!1,live:O=!1}){const[S,F]=(0,t.useState)(0),[P,R]=(0,t.useState)(0),N=j.getTime()-18e5,B=T.getTime()+36e5,E=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(N),new Date(B),w),[e,N,B,w]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(M,W,X),[M,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=z&&P?Math.max(24,Math.floor(P)):Math.max(48,v-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=C?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:O,past:D,closed:A}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},he=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),de=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&de.push(t.getTime())}const ue=O?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),xe=A?null:O?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,ge=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:de,busiest:xe}):{hours:[],busiest:null},me=he(E),pe=le?he(ae.before):me,fe=le?he(ae.after):'',ye=_&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,we=ge.busiest?.text??(A?'':O?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),Me=U.map(e=>e.spoken).join('. '),ve=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${we?` ${we}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${ve} percent of the way through the day.`:''}${Me?` ${Me}.`:''}`,$e=(0,u.hm)(b),De=Math.max(44,12*$e.length*.7+16),Ae=Math.max(q+2,Math.min(Math.max(0,S-J-De),se(re)-De/2)),Ie=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,z?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:L?4:C?2:10,paddingBottom:L?2:6,backgroundColor:c.colours.bg}],children:[L?null:I?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),L||H?null:A?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ke,onLayout:e=>{F(e.nativeEvent.layout.width),z&&R(e.nativeEvent.layout.height)},style:z?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,v-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,A?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,ge.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:ge.busiest.x+ge.busiest.w/2,y:ge.busiest.y+ge.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:ge.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Ae,top:Ie,minWidth:De,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),ge.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':i(0,f.coverCurve)(e,new Date(N),new Date(B),v),[e,N,B,v]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(w,W,X),[w,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=O&&P?Math.max(24,Math.floor(P)):Math.max(48,M-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=A?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:$,closed:I}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},de=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),he=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&he.push(t.getTime())}const ue=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),ge=I?null:H?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,xe=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:he,busiest:ge}):{hours:[],busiest:null},me=de(E),pe=le?de(ae.before):me,fe=le?de(ae.after):'',ye=z&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ve=xe.busiest?.text??(I?'':H?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),we=U.map(e=>e.spoken).join('. '),Me=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=!I&&K&&K.covers?(0,m.peakOccupancyText)(K.t,K.covers):'',De=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${ke?` ${ke}.`:''}${ve?` ${ve}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${Me} percent of the way through the day.`:''}${we?` ${we}.`:''}`,$e=(0,u.hm)(b),Ie=Math.max(44,12*$e.length*.7+16),Le=Math.max(q+2,Math.min(Math.max(0,S-J-Ie),se(re)-Ie/2)),Ae=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[h.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:C?4:A?2:10,paddingBottom:C?2:6,backgroundColor:c.colours.bg}],children:[C?null:L?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te}),ke?(0,y.jsx)(d.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:ke}):null]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:A?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),C||_?null:I?k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),ke&&!L?(0,y.jsx)(d.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:ke}):k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),C||_||L||!k||!ke?null:(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),C||!_||!ke||L?null:(0,y.jsx)(d.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:ke}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:De,onLayout:e=>{F(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,xe.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:xe.busiest.x+xe.busiest.w/2,y:xe.busiest.y+xe.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:xe.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(d.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Le,top:Ae,minWidth:Ie,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(d.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),xe.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1397,[]); __d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1398,[1092]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1399,[861,1378]); diff --git a/customer-app/admin.html b/customer-app/admin.html index 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 3817f46dfda7c8b7cc7ec0b5cad44b3652d41150..1153544f4c508edd3e7c65a0aafb8fbc339d53b2 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 51da6623e1127d98ab747451f655ff39ed535d3c..168961583eec9e0c62acf47cb968c213d0f99cdb 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-6e6a5a61c3"; +const V = "cc-customer-0107aa1dc1"; 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=6e6a5a61c30c7b5556cc1011d4783486adec61dabe36ee6c413741ca937510a7"]; +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=0107aa1dc19d3b8037a359f7acb736970aa3ee9bf5324c2737f5dfdb0df410c9"]; // 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 31ebd03b3e99d95bb45f4829776ad7ddf975e237..b9a6bc5182aea853661a1d4f176edfaf69f7c36d 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 40f7ffab337ccafaf8aa89b10eb7158b11f33c08..7a399b957b18bd33385b87964f8b626196a63ac2 100644 --- a/display-app/_expo/static/js/web/bundle.js +++ b/display-app/_expo/static/js/web/bundle.js @@ -5,7 +5,7 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() !(function(r){let l=0,n=!0===r.RN$useAlwaysAvailableJSErrorHandling?r.RN$handleException:(r,l)=>{throw r};const t={setGlobalHandler(r){n=r},getGlobalHandler:()=>n,reportError(r){n&&n(r,!1)},reportFatalError(r){n&&n(r,!0)},applyWithGuard(r,n,e,a,o){try{return l++,r.apply(n,e)}catch(r){t.reportError(r)}finally{l--}return null},applyWithGuardIfNeeded:(r,l,n)=>t.inGuard()?r.apply(l,n):(t.applyWithGuard(r,l,n),null),inGuard:()=>!!l,guard(r,l,n){if('function'!=typeof r)return console.warn('A function must be passed to ErrorUtils.guard, got ',r),null;const e=l??r.name??'';return function(...l){return t.applyWithGuard(r,n??this,l,null,e)}}};r.ErrorUtils=t})('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof global?global:'undefined'!=typeof window?window:this); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,20]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&!t.PITCH_ANCHORAGE&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=o=>{if(3===o.nodeType){const e=o.nodeValue??'',a=(0,n.pitchText)(e,t.PITCH_ANCHORAGE);return void(a!==e&&(o.nodeValue=a))}if(1!==o.nodeType)return;const a=o;if('INPUT'===a.tagName||'TEXTAREA'===a.tagName){const e=a,o=(0,n.pitchText)(e.value,t.PITCH_ANCHORAGE);o!==e.value&&(e.value=o);const i=e.getAttribute('placeholder');if(i){const o=(0,n.pitchText)(i,t.PITCH_ANCHORAGE);o!==i&&e.setAttribute('placeholder',o)}}for(const e of['aria-label','title']){const o=a.getAttribute(e);if(o){const i=(0,n.pitchText)(o,t.PITCH_ANCHORAGE);i!==o&&a.setAttribute(e,i)}}a.childNodes.forEach(e)},o=()=>{e(document.body),document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE),new MutationObserver(o=>{for(const t of o)'characterData'===t.type?e(t.target):t.addedNodes.forEach(e),'attributes'===t.type&&e(t.target);document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?o():document.addEventListener('DOMContentLoaded',o)}}},1,[2,3,16,18,19]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!0},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!1},2,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return c.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return R}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]);const u={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[6]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},h={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},f={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},b={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},p=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:f,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...u,orderAtTable:!1,pay:h,cashUpRecord:[...l.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:8,bookingNoticeMins:15,autoAcceptUpTo:8},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...u,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],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']},settings:{...u,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],A={by:'Fictional demo',at:'2026-10-26'},T=(t,n,o,s,c,l,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:c,price:l,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:A}),R=[T('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),T('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),T('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),T('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),T('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),T('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),T('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),T('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),T('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),T('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13,15]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="anchorage".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); @@ -1070,7 +1070,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()})},987,[35,988]); __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},988,[985,948,989]); __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'}},989,[985]); -__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.189'},990,[]); +__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.190'},990,[]); __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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},991,[992,993,904,948,988]); __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())}}}},993,[948]); @@ -1244,7 +1244,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 e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1161,[35,403,103,795,868,822,1154,1153,1158,1011,26]); __d(function(g,_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.ChefForecast=function({openPrep:e}){const{r:f,rid:y,now:b}=(0,u.useChef)(6e4),x=(0,l.useBookings)(y),p=(0,l.useOrders)(y),j=(0,l.useEvents)(y),k=(0,a.useRealHistory)(y,b),w=(0,d.ymd)(b),[T,$]=(0,o.useState)(7),{covers:v,enough:C,booked:D,pct:I,day:A,example:L}=(0,u.useForecast)(),M=0===I?`about a usual ${A}`:`${Math.abs(I)}% ${I>0?'busier':'quieter'} than a usual ${A}`,z=(0,o.useMemo)(()=>Array.from({length:T},(e,o)=>{const s=0===o?b:(0,d.addMins)((0,d.parseYmd)(w),1440*o),t=(0,i.forecastToday)(f,x,p,j,s,k??void 0);return{d:s,f:t,booked:t.hours.reduce((e,o)=>e+o.booked,0),covers:t.hours.reduce((e,o)=>e+o.covers,0)}}),[f,x,p,j,w,T,k,b.getTime()/6e5|0]),B=z[0].f,R=z.map(e=>({key:(0,d.ymd)(e.d),label:(0,d.dayShort)(e.d),spoken:(0,d.dayLong)(e.d),value:e.f.open?C?e.covers:e.booked:0,open:!!e.f.open}));return(0,h.jsxs)(t.default,{style:{gap:12},testID:"chef-forecast",children:[(0,h.jsx)(r.Muted,{center:!0,testID:"chef-forecast-busy",children:B.busy.words}),C?null:(0,h.jsx)(a.NotEnoughHistory,{weeks:B.minWeeks,booked:D}),(0,h.jsxs)(r.Card,{children:[(0,h.jsxs)(t.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,h.jsxs)(r.T,{center:!0,weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:[7===T?'This week':`Next ${T} days`," \xb7 ",C?'forecast covers':'booked covers']}),C?B.example?(0,h.jsx)(a.ExampleBadge,{}):(0,h.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"}):null]}),(0,h.jsx)(r.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,h.jsx)(r.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:T===e,onPress:()=>$(e),testID:`chef-forecast-range-${e}`},e))}),(0,h.jsx)(c.DaysLineGraph,{days:R,titleSpoken:`${C?'Forecast':'Booked'} covers for the next ${T} days`})]}),(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:"Covers per day"}),(0,h.jsxs)(t.default,{testID:"chef-forecast-days",children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',paddingVertical:6,borderBottomWidth:1,borderColor:n.colours.hairline},children:[(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{flex:1,textAlign:'left'},children:"Day"}),(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:72,textAlign:'right'},children:"Booked"}),C?(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:84,textAlign:'right'},children:"Forecast"}):null]}),z.map((e,o)=>{const s=0===o;return(0,h.jsxs)(t.default,{testID:`chef-forecast-day-${(0,d.ymd)(e.d)}`,accessible:!0,accessibilityLabel:e.f.open?`${(0,d.dayLong)(e.d)}: ${e.booked} booked${C?`, about ${e.covers} forecast`:''}`:`${(0,d.dayLong)(e.d)}: closed`,style:{flexDirection:'row',alignItems:'center',minHeight:40,borderBottomWidth:o({minHeight:48,borderRadius:12,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:e?n.colours.goldTint:'transparent'}),children:(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,children:"Open prep list \u203a"})})]})]})};var o=_r(_d[0]),s=e(_r(_d[1])),t=e(_r(_d[2])),r=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),d=_r(_d[6]),n=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11])},1162,[35,403,103,795,875,1155,859,822,1163,1159,1158,26]); __d(function(g,_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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1163,[829,35,284,365,237,103,427,798,795,828,822,1164,26]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,l=u,f=Math.max(10,i-s-l),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let M=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(p=n.busiest.t,s+(p-n.t0)/x*f-o/2);M={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var p;return{hours:b,busiest:M}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xf+(t-c)/M*b,w=l.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:p(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',f=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=l.indexOf(n);return t+(o<0?1e3:f[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.peakOccupancyText=function(t,n){const o=String(new Date(t).getHours()).padStart(2,'0');return`Peak ${n} ${1===n?'cover':'covers'} at ${o}:00`},e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,f=u,l=Math.max(10,i-s-f),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let p=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(M=n.busiest.t,s+(M-n.t0)/x*l-o/2);p={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var M;return{hours:b,busiest:p}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xl+(t-c)/p*b,w=f.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:M(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',l=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=f.indexOf(n);return t+(o<0?1e3:l[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); __d(function(g,_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.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,I.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,I.useForecast)(),f=(0,k.ymd)(i),p=(0,R.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),m=p.reduce((e,t)=>e+t.sold,0)||1,x=p.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/m)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),b={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{b[e.ing]=(b[e.ing]??0)+e.qty*t.qty}));const y=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini-fish-goujons','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,$.fmtQty)(Math.ceil(2*(b.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,$.fmtQty)(Math.ceil(10*(b.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,$.fmtQty)(Math.ceil(10*(b.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,$.fmtQty)(Math.ceil(2*(b.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,D.useKitchen)(e=>e.tickPrep),w=[...y.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=w.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,q.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,q.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} Covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,q.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} Covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," Covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,q.jsx)(u.Badge,{kind:S===w.length?'ok':'gold',label:`${S}/${w.length} done`})]}),w.map((t,i)=>{const n=e.prepTicks[t.key];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?C.colours.ok:C.colours.border,backgroundColor:C.colours.surface,marginTop:i===y.length?8:0},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:C.colours.muted}:void 0,children:t.text}),n?(0,q.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,q.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,I.useChef)(),a=(0,I.useWeek)(),d=(0,D.useKitchen)(e=>e.addWaste),[f,p]=(0,o.useState)(e.ingredients[0]?.id),[m,x]=(0,o.useState)(''),[b,y]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),k=Number(m.replace(',','.'))||0,S=k>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*k)),T=w&&S?(0,s.inputQuantity)(l,w,k):0,v=e.waste.filter(e=>(0,I.within7)(e.at,r));return w?(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,q.jsx)(I.Tile,{label:"Waste this week",value:(0,j.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,q.jsx)(I.Tile,{label:"Waste as % of food sales",value:a.sales?(0,I.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,q.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,q.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,q.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>p(e.id)},e.id))})}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:m,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:C.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),(0,q.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,q.jsx)(u.T,{weight:"semibold",colour:C.colours.gold,children:(0,j.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,q.jsxs)(u.Row,{children:[(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(k)-.5)))}),(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(k)+.5))}),(0,q.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:D.WASTE_REASONS.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===b,onPress:()=>y(e)},e))}),(0,q.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:b,cost:Math.round(T*w.cost)}),x('')}}),(0,q.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,q.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,q.jsx)(u.T,{size:14,children:(0,j.gbp)(e.cost)})]},e.id))]}):(0,q.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,I.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,b.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'},c=(0,m.useUnsignedDishes)(i),[x,j]=(0,o.useState)(!1);return x?(0,q.jsx)(m.UnsignedDishList,{rid:i,actor:a,onClose:()=>j(!1),onOpenCards:e}):(0,q.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,q.jsx)(d.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>j(!0),style:({pressed:e})=>({minHeight:48,opacity:e?.85:1}),children:(0,q.jsxs)(u.Card,{style:{alignItems:'center'},highlight:c.length?C.colours.amber:void 0,children:[(0,q.jsx)(u.Muted,{center:!0,children:"Dishes not signed off"}),(0,q.jsx)(u.T,{center:!0,size:20,weight:"bold",children:c.length})]})}),(0,q.jsx)(u.Muted,{children:"The 14 allergens from each recipe card. These are what guests see on the menu, takeaway and the booking allergy check. A red warning means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,q.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,l.map(({card:e,fromCosting:t})=>(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",center:!0,children:e.dish}),(0,q.jsx)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i,r='contains'===i?'Contains':'may'===i?'May contain':n?'In costing recipe, not on card':'Not listed';return(0,q.jsxs)(h.default,{accessible:!0,accessibilityLabel:`${e.dish}, ${s.label}: ${r}`,style:{flexGrow:1,flexBasis:220,minWidth:180,maxWidth:'100%',padding:8,borderRadius:8,backgroundColor:n?C.colours.redBg:C.colours.surface2},children:[(0,q.jsx)(u.T,{center:!0,size:14,weight:"semibold",children:s.label}),(0,q.jsx)(u.T,{center:!0,size:14,colour:n?C.colours.red:'contains'===i?C.colours.gold:C.colours.muted,children:r})]},s.id)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Not listed means the allergen is not recorded on this recipe card. Check any costing warnings before sign-off."}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,q.jsxs)(u.Card,{highlight:s.length?C.colours.red:C.colours.amber,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,q.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,q.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,q.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,p.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,q.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,q.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,I.useChef)(),l=(0,k.ymd)(i),a=(0,D.useKitchen)(e=>e.addTemp),c=(0,x.useOwner)(e=>e.checks),{tick:f,untick:p}=x.useOwner.getState(),[m,b]=(0,o.useState)('fridge'),y=E.find(e=>e.id===m),j={...y,units:y.units.filter(e=>(0,n.chefCanSee)(r,e))},[w,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,M=e.temps.filter(e=>e.at.slice(0,10)===l),B=(e,t,i)=>{const n=c[e];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?p(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,children:t}),(0,q.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:E.map(e=>(0,q.jsx)(u.Chip,{label:e.label,selected:e.id===m,onPress:()=>{b(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===w,onPress:()=>S(e)},e))}),(0,q.jsx)(u.Muted,{children:j.rule}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:C.colours.muted,style:{width:90,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),null===$?null:(0,q.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,q.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:m,unit:w,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,q.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",M.length,")"]}),M.length?M.map(e=>{const t=E.find(t=>t.id===e.kind)?.ok(e.temp);return(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,q.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,q.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?C.colours.ok:'warn'===t?C.colours.amber:C.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,q.jsx)(u.Muted,{children:"None yet today."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,q.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),G.map(e=>B(`${l}:kc-${e.id}`,e.text))]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),F.map(e=>B('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,I.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,v.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??I.CHEF_ID,role:'staff'}),[d?.id]),u=(0,T.useChatOpen)(e=>e.ch);return(0,o.useEffect)(()=>{u&&a('chat')},[u]),(0,q.jsx)(S.ChatAsCtx.Provider,{value:c,children:(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(H,{sub:r,setSub:a}),'live'===r?(0,q.jsx)(_,{}):'soldout'===r?(0,q.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,q.jsx)(V,{}):(0,q.jsx)(U,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),D=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),z=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]),N=_r(_d[36]),W=_r(_d[37]),q=_r(_d[38]);const E=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],F=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],G=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function H({sub:e,setSub:t}){const{total:s}=(0,S.useChatUnread)();return(0,q.jsx)(I.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function U(){return(0,q.jsx)(S.Chat,{go:()=>{}})}function _(){const{rid:e,r:t,me:s,now:i}=(0,I.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))),c=(e,t)=>!!(0,B.statusBlock)(e,t,(0,B.linkedBooking)(e,n)),p=(0,b.ticketView)('chef',d),m=(0,f.useStore)(e=>e.setOrderStatus),x=(0,f.useStore)(e=>e.ackReadiness),j=d.flatMap(e=>(0,w.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,q.jsxs)(h.default,{style:{gap:8},children:[j.length?(0,q.jsx)(u.Banner,{kind:"warn",title:`${j.length} readiness alert${j.length>1?'s':''}`,children:j.map(e=>e.detail).join(' \xb7 ')}):(0,q.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,q.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,p.length?p.map(e=>(0,q.jsxs)(u.Card,{highlight:e.allergies.length&&(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))&&'ready'!==e.status?C.colours.red:void 0,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`Table ${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,q.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,q.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,q.jsxs)(u.T,{size:13,colour:C.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,q.jsx)(M.AllergyChain,{o:e,me:s}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{m(e.id,'preparing',s),'takeaway'===e.type&&x(e.id,'cook',s)}}):null,'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>m(e.id,'ready',s)}):null]})]},e.id)):(0,q.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const K=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,k.ymd)(new Date(s,i-1,n+t))};function V(){const{now:e,today:t}={...(0,I.useChef)(6e4),today:(0,k.ymd)(new Date)},{staff:s,shifts:i}=(0,b.rotaView)('chef',(0,x.useOwner)(e=>e.staff),(0,x.useOwner)(e=>e.shifts)),n=(0,x.useOwner)(e=>e.leave),r=(0,N.canEditKitchenRota)((0,P.useSync)(e=>e.perms)),l=(0,x.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),a=(0,v.weekday)(e),o=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),d=(0,z.useSession)(e=>e.meId),c=(0,P.useSync)(e=>e.staffRef),f=d??c??I.CHEF_ID,p=(0,x.useOwner)(e=>e.staff.find(e=>e.id===f)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(L.BreakRoomCard,{staffId:f,name:p,now:e}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"On now"}),l.length?l.map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,q.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,q.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",v.DAY3[a],")"]}),i.filter(e=>e.date===t).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,W.leaveCovering)(n,e.staffId,e.date)?(0,q.jsx)(u.T,{size:13,colour:C.colours.blue,children:(0,W.leaveLabel)((0,W.leaveCovering)(n,e.staffId,e.date))}):(0,q.jsxs)(u.Muted,{children:[(0,v.fmtH)(e.start),"\u2013",(0,v.fmtH)(e.end)]})]},e.id))]}),r?(0,q.jsx)(u.Card,{children:(0,q.jsx)(A.KitchenRotaEditor,{today:t})}):(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),o.map(e=>(0,q.jsxs)(h.default,{style:{gap:4},children:[(0,q.jsx)(u.T,{size:14,children:e.name}),(0,q.jsx)(u.Row,{wrap:!0,gap:4,children:v.DAY3.map((s,n)=>{const r=i.find(s=>s.staffId===e.id&&s.date===K(t,n-a));return(0,q.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:r?C.colours.goldTint:C.colours.surface2,alignItems:'center'},children:[(0,q.jsx)(u.T,{size:10,colour:C.colours.muted,children:s}),(0,q.jsx)(u.T,{size:10,children:r?`${(0,v.fmtH)(r.start).slice(0,2)}\u2013${(0,v.fmtH)(r.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})]})}},1165,[828,955,1166,836,861,1167,1168,35,403,296,103,795,875,883,1169,892,966,862,868,1172,859,822,1173,1099,1073,1154,1153,1174,870,1158,1011,896,1175,977,958,1178,961,1087,26]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1166,[1153,955]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1167,[828,35,103,795,875,950,892,951,952,953,832,822,26]); @@ -1261,7 +1261,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";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=w,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,l.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,y.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,y.jsx)(w,{today:e}):(0,y.jsx)(I,{today:e})})},_e.KitchenRotaRead=I;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],j=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,k=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,p=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function w({today:e=(0,h.ymd)(new Date)}){const r=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,l.kitchenTeam)(r),[r]),$=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[w,I]=(0,t.useState)(0),S=(0,f.useDateCalendar)(),[v,C]=(0,t.useState)(null),[T,H]=(0,t.useState)(''),P=(0,a.addDays)((0,a.mondayOfDate)(e),7*w),L=(0,a.addDays)(P,6),R=b.map((e,t)=>(0,a.addDays)(P,t)),M=(0,l.kitchenPending)(o,$,P,L).length,O=e=>{H(e),(0,u.announce)(e)},W=0===w?'This week':1===w?'Next week':-1===w?'Last week':`Week of ${k(P)}`;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center',flexWrap:'nowrap'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(w-1),H('')},style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${W}, ${x[0]} ${k(P)} to ${x[6]} ${k(L)}`,style:{alignItems:'center',minWidth:120,flex:1},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:W}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(P)," \u2013 ",j(L)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(w+1),H('')},style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:S.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:S.calOpen,today:e,day:P,showBusy:!0,idPrefix:"krota-cal",onClose:S.closeCal,onDay:t=>{I((0,f.weekOffsetOf)(t??e,e)),H('')}}),d.map(t=>(0,y.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[p(t.nickname||t.name),t.job?(0,y.jsx)(n.T,{size:12,colour:m.colours.muted,children:` ${t.job}`}):null]}),(0,y.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:R.map((i,a)=>{const l=o.find(e=>e.staffId===t.id&&e.date===i),r=!(!l||l.published&&!l.changed),d=`${p(t.nickname||t.name)}, ${x[a]} ${k(i)}, ${l?`${(0,c.fmtH)(l.start)} to ${(0,c.fmtH)(l.end)}${r?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,y.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>C({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:r?'dashed':'solid',borderColor:l?r?m.colours.amber:m.colours.gold:m.colours.border,backgroundColor:e||l?m.colours.goldTint:m.colours.surface2}),children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:i===e?m.colours.gold:m.colours.muted,children:b[a]}),(0,y.jsx)(n.T,{size:10,center:!0,children:l?`${(0,c.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(l.end).slice(0,5)}):(0,y.jsx)(n.T,{size:10,center:!0,colour:m.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,y.jsx)(n.Button,{testID:"krota-publish",kind:M?'primary':'secondary',disabled:!M,label:M?`Publish kitchen rota (${M} ${1===M?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:M?`Publish the kitchen rota for ${W.toLowerCase()}, ${M} ${1===M?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,$,P,L);a.useOwner.getState().setShifts(e.shifts),O(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,y.jsx)(i.default,{testID:"krota-msg",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.goldLight,children:T})}):null,(0,y.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),v?(0,y.jsx)(D,{init:v,onClose:()=>C(null),onSaid:O}):null]})}function I({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:l}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,$]=(0,t.useState)(0),w=(0,f.useDateCalendar)(),I=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),D=(0,a.addDays)(I,6),S=b.map((e,t)=>(0,a.addDays)(I,t)),v=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),C=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${k(I)}`,[T,H]=(0,t.useState)(0),P=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>H(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>$(u-1),style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${C}, ${x[0]} ${k(I)} to ${x[6]} ${k(D)}`,style:{alignItems:'center',minWidth:120},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:C}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(I)," \u2013 ",j(D)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>$(u+1),style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:w.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:w.calOpen,today:e,day:I,showBusy:!0,idPrefix:"krota-read-cal",onClose:w.closeCal,onDay:t=>$((0,f.weekOffsetOf)(t??e,e))}),v.map(t=>(0,y.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:p(t.nickname||t.name)}),(0,y.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=l.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,r.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,r.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,y.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${p(t.nickname||t.name)}, ${x[a]} ${k(s)}, ${u}`,style:{width:P,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.goldTint:m.colours.surface2},children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:s===e?m.colours.gold:m.colours.muted,children:b[a]}),o&&h?(0,y.jsx)(n.T,{size:9,center:!0,colour:m.colours.blue,children:(0,r.leaveLabel)(h).toLowerCase()}):(0,y.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),v.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,y.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function D({init:e,onClose:s,onSaid:r}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=p(o?.nickname||o?.name||''),[u,f]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[j,w]=(0,t.useState)(!1),[I,D]=(0,t.useState)(''),S=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${k(e.date)})`;return(0,y.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${S}`,testID:"krota-sheet",children:(0,y.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,y.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{f(t),x(s)}},e))}),(0,y.jsx)(n.T,{center:!0,children:"Start"}),(0,y.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:f,format:c.fmtH,label:"Start time"}),(0,y.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,y.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,y.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),I?(0,y.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.amber,children:I})}):null,(0,y.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?D(`${d} already has a shift that overlaps on ${S}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),r(`${e.shift?'Changed':'Added'}: ${d}, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!j?(0,y.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&j?(0,y.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",S,"?"]}),(0,y.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),r(`Removed ${d}'s shift on ${S}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,y.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1178,[35,403,103,795,892,961,1087,966,958,1076,859,1111,1067,822,26]); __d(function(g,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.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1179,[1166,955,35,380,103,795,892,966,868,822,1073,1158,1011,1180,26]); __d(function(g,_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.openLink=w,_e.useSheetReminders=C,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=C(),f=(0,b.wd)(l);return(0,j.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,j.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,j.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,j.jsx)($,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,j.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]);function w(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function k(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const S={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},T={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function C(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function $({s:e,open:n,onToggle:o}){const{rid:C,r:$,me:D,now:I}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),M=(0,u.useOrderSheets)(e=>e.markOpened),B=(0,u.useOrderSheets)(t=>t.opened[e.id]),[L,P]=(0,s.useState)({}),[O,R]=(0,s.useState)(''),[A,z]=(0,s.useState)(''),[_,W]=(0,s.useState)(!1),H=(0,h.useShellfish)(C,D,'chef'),K=(0,b.nextDelivery)(e,I),E=(0,b.orderLines)(e,L,O,C),N=($.address??$.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=N.length>=3?N[1]:N[0]??'',U=(0,b.orderMessage)(e,$.name,q,E,D.split(' ')[0],I),Q=e.orderDays.includes((0,b.wd)(I)),Y=(e,t)=>P(n=>({...n,[e.id]:(0,l.stepQuantity)(C,e,n[e.id]||0,t)})),F=t=>{M(e.id,I.toISOString()),w(t)},G='text'===e.method||'whatsapp'===e.method||'phone'===e.method,V=Math.round(100*((0,y.parseMoneyInput)(A)??NaN)),J=H.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),X=J.filter(e=>H.isLow(e.key));return(0,j.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:Q||X.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,j.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[S[e.method]," ",e.name]}),(0,j.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,j.jsx)(i.Muted,{children:e.goods}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,j.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,j.jsx)(i.Badge,{kind:Q?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,j.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,j.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,J.length?(0,j.jsx)(i.Badge,{kind:X.length?'amber':'ok',label:J.map(e=>`${e.icon} ${(0,c.fmtStockCount)(C,e,H.counts[e.key]??0)}`).join(' \xb7 ')}):null,B&&new Date(B).toDateString()===I.toDateString()?(0,j.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,j.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[K?(0,j.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(K),"."]}):null,e.reminder?(0,j.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,j.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,j.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,j.jsxs)(d.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{children:[e.name,e.unit?(0,j.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(C,e),")"]}):null]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Y(e,-1),style:{minWidth:44,minHeight:44}}),(0,j.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(C,e,L[e.id]||0),children:(0,j.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(C,e)?(0,l.fishQtyText)(C,e,L[e.id]||0):L[e.id]||0})}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Y(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,j.jsx)(t.TextInput,{value:O,onChangeText:R,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[T,{minHeight:60}]})]}),G?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(C,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,'online'===e.method?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(C,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,e.priceCapPerKg?(0,j.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,j.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,j.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,j.jsx)(t.TextInput,{testID:"price-found",value:A,onChangeText:e=>z((0,y.sanitiseMoneyTyping)(e)),keyboardType:"decimal-pad",inputMode:"decimal",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[T,{width:120}]})]}),V>0?(0,j.jsx)(i.Badge,{kind:V<=e.priceCapPerKg?'ok':'red',label:V<=e.priceCapPerKg?`${(0,p.gbp)(V)}/kg is under the cap \u2713`:`${(0,p.gbp)(V)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,j.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,j.jsx)(i.T,{size:f.font.small,children:E.length?U:'Add quantities above to write the order.'})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!E.length,onPress:()=>F((0,b.smsLink)(e.number,U))}):null,'whatsapp'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!E.length,onPress:()=>F((0,b.waLink)(e.number,U))}):null,'phone'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>F((0,b.telLink)(e.number))}):null,'online'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>F(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&E.length?(0,j.jsx)(i.Button,{kind:"ghost",label:_?'Copied \u2713':'Copy order',onPress:async()=>{const e=await k(U);W(e),e&&setTimeout(()=>W(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,j.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,j.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1180,[828,836,955,35,380,237,403,103,795,1009,954,956,868,1010,822,1158,14,26]); -__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); +__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',justifyContent:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},1182,[5,823,824,829,237,827]); __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,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',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,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',w:64,h:45}}},1183,[]); __d(function(g,_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(', '))})]})}},1184,[828,1009,1166,955,35,403,103,795,892,868,822,1158,1011,14,26]); @@ -1295,7 +1295,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.AssignRoleSheet=function({name:e,when:s,current:u,onSave:b,onEditTimes:y,onClose:j}){const x={minHeight:o.IS_CAR?64:56,width:'100%'},_=(0,l.cleanBadge)(u);return(0,c.jsxs)(n.Sheet,{visible:!0,onClose:j,title:"Assign a role?",testID:"assign-role-sheet",maxWidth:560,children:[(0,c.jsx)(n.T,{size:18,center:!0,weight:"semibold",children:e}),(0,c.jsx)(n.Muted,{center:!0,children:s}),(0,c.jsxs)(t.default,{style:{gap:8,width:'100%'},children:[l.ROLE_BADGES.map(e=>(0,c.jsx)(n.Button,{kind:_===e?'primary':'secondary',label:e,testID:`assign-role-${h(e)}`,accessibilityLabel:`${e}${_===e?', chosen':''}`,onPress:()=>b(e),style:x},e)),(0,c.jsx)(n.Button,{kind:_?'secondary':'primary',label:"None",testID:"assign-role-none",accessibilityLabel:_?'None, clear the role badge':'None, chosen',onPress:()=>b(void 0),style:x}),y?(0,c.jsx)(n.Button,{kind:"ghost",label:"Edit shift times",testID:"assign-role-edit-times",onPress:y,style:x}):null]})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),o=r(d[4]),c=r(d[5]);const h=e=>e.replace(/\s+/g,'-').toLowerCase()},1212,[35,103,795,1211,873,26]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1213,[35,103,795,892,822,1073,1076,1209,1087,26]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1214,[35,103,1073,822,795,26]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),f=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),u=(0,n.useOwner)(e=>e.staff),x=(0,o.workingNow)(f,u,t),w=(0,o.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:r.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:r.colours.muted,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:r.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:r.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:r.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:r.colours.muted,center:!0,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:r.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:r.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),h=_r(d[7])},1215,[35,103,1073,892,1216,822,795,26]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:t=!1,marquee:s=!1}={}){const{today:u}=(0,o.useCtx)(15e3),p=(0,l.useOwner)(e=>(0,l.liveAttendance)(e.attendance)),j=(0,l.useOwner)(e=>e.staff),I=(0,r.workingNow)(p,j,u),D=(0,r.cardSpeech)(I),[k,v]=(0,e.useState)(0),[L,S]=(0,e.useState)(0),[W,O]=(0,e.useState)(y);if((0,e.useEffect)(()=>{t&&s&&x()},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'function'!=typeof window.matchMedia)return;const e=window.matchMedia('(prefers-reduced-motion: reduce)'),n=()=>O(!!e.matches);return n(),e.addEventListener?e.addEventListener('change',n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener('change',n):e.removeListener(n)}},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'undefined'==typeof ResizeObserver)return;const e=document.querySelector('[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]');if(!e)return;const n=()=>{const t=e.querySelector('[data-testid="whos-on-shift-list"]');v(e.clientWidth),t&&S(Math.max(t.scrollWidth,t.offsetWidth))},o=new ResizeObserver(n);o.observe(e);const l=e.querySelector('[data-testid="whos-on-shift-list"]');return l&&o.observe(l),n(),()=>o.disconnect()},[t,s,I.length,D]),t&&s){const e=k>0&&L>k+1&&f&&!W,t=w.find(e=>e>=Math.round((L+48)/32))??80,s=0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,numberOfLines:1,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",children:(0,h.jsx)(b,{rows:I,testIds:!0})});return(0,h.jsxs)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:0,paddingHorizontal:10,height:44,maxHeight:44,minHeight:44,overflow:'hidden',width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',gap:8},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",numberOfLines:1,style:{flexShrink:0},children:r.CARD_TITLE}),(0,h.jsxs)(n.default,{testID:"whos-on-shift-marquee",onLayout:e=>v(e.nativeEvent.layout.width),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,height:44,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:[(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",onLayout:e=>S(e.nativeEvent.layout.width),style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row',flexWrap:'nowrap',flexShrink:0,width:'max-content'},children:(0,h.jsx)(b,{rows:I,testIds:!1})}),e?(0,h.jsxs)(n.default,{dataSet:{ccwho:`tick-${t}`},style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center'},children:[(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:s}),(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:(0,h.jsx)(b,{rows:I,testIds:!1})})]}):(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,width:'max-content'},children:s})]})]})}if(t)return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:d.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:18,colour:d.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:d.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:d.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]);const f='undefined'!=typeof document,w=[18,24,32,40,50,64,80],u=`\n[data-testid="display-whos-on-top"]{overflow:hidden;max-width:100%;width:100%}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"] *{flex-wrap:nowrap!important;white-space:nowrap}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"]{display:inline-flex!important;flex-direction:row;align-items:center;width:max-content!important;max-width:none!important}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]>[data-ccwho],[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;width:max-content}\n${w.map(e=>`[data-testid="display-whos-on-top"] [data-ccwho="tick-${e}"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;animation:ccwho-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccwho-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{animation:none!important}}\n`;let p=!1;function x(){if(!f||p)return;p=!0;const e=document.createElement('style');e.setAttribute('data-ccwho-css','1'),e.textContent=u,document.head.appendChild(e)}const y=()=>f&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;function b({rows:e,testIds:t}){return(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',columnGap:10,flexShrink:0,width:'max-content'},children:e.map(e=>(0,h.jsxs)(n.default,{testID:t?`whos-on-shift-${e.staffId}`:void 0,accessible:t,accessibilityLabel:t?e.speech:void 0,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,numberOfLines:1,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,numberOfLines:1,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})}},1215,[35,237,103,1073,892,1216,822,795,26]); __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1216,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1217,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1218,[]); @@ -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,[828,861,35,103,795,862,868,1168,1332,875,822,26]); __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,[904,958,1168]); __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,[31,35,873,1334,1404,26]); -__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=e(_r(_d[40])),G=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]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ye.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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:l?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:l?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),s?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.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||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ye.jsx)(Q.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${s.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ye.jsx)(Q.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ye.jsx)(Q.T,{size:12,colour:se.colours.muted,children:l}):null]})}function at({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,s));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:l?16:18,weight:"bold",children:[it(e)," \xb7 ",lt(e.customerName)]}),(0,Ye.jsx)(Q.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,Ye.jsxs)(Q.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,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,le.useRestaurant)(jt);(0,Re.useAlertWatcher)(jt,{enabled:!e});const kt=(0,le.useOrders)(jt),It=(0,le.useBookings)(jt),Dt=(0,le.useEvents)(jt),vt=(0,le.useStore)(e=>e.skipMinutes),St=(0,le.useStore)(e=>e.clock.mode),Ct=(0,le.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Rt=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,Ne.workingShifts)(Rt,Bt),[Rt,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Wt=(0,$.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:lt(Tt.find(e=>e.id===Wt)?.name)}),Ht=I.IS_CAR?'Car':'Display';(0,L.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,ne.useFrontDoor)(Pt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Ft=(0,re.useFloor)(e=>e.live[jt]),Gt=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,el]=(0,H.useState)(null),[tl,ll]=(0,H.useState)(null),[sl,il]=(0,H.useState)(!1),[ol,nl]=(0,H.useState)(!1),[al,rl]=(0,H.useState)(null),[dl,cl]=(0,H.useState)(!1),[ul,hl]=(0,H.useState)(!1),[gl,bl]=(0,H.useState)(!1),[yl,pl]=(0,H.useState)(null),[fl,xl]=(0,H.useState)(null),[ml,jl]=(0,H.useState)(null),[wl,kl]=(0,H.useState)(!1),Il=P.default.useRef(0),Dl=e=>{Il.current=Date.now(),jl(e)};P.default.useEffect(()=>{if(!ml)return;const e=setInterval(()=>{Date.now()-Il.current>=He.DAY_IDLE_MS&&jl(null)},5e3);return()=>clearInterval(e)},[ml]);const vl=(0,le.useWaitlist)(jt),Sl=(0,le.useStore)(e=>e.walkIns[jt]??0),[Cl,Tl]=(0,H.useState)(!1),[$l,Rl]=(0,H.useState)(!1),[Bl,Ll]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Wl,zl]=(0,H.useState)({view:0,content:0}),[Hl,Pl]=(0,H.useState)(null);P.default.useEffect(()=>{Hl&&((0,W.notify)({id:`floor-note:${Date.now()}`,title:Hl,timeoutMs:4500,big:!0,testID:'floor-toast'}),Pl(null))},[Hl]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Ml,Al]=(0,H.useState)(null),El=P.default.useRef(0),[Ol,Nl]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ml)return;El.current=Date.now();const e=setInterval(()=>{const e=Date.now()-El.current;if(e>=Xe)return Al(null),void Pl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nl(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ml]);const _l=e=>e.date!==Pt?ll({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!ci.ok,accessibilityHint:ci.hint,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ll({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ll(null),Pl(e)}}):null,e.walkIn?(0,Ye.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ll(null),Pl(e)}}):null,(0,Se.bookingDetails)(e)]})}),Fl=It.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),Gl=Fl.filter(e=>!['cancelled','noshow'].includes(e.status)),Vl=kt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ul=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),Kl=(0,Be.closedAreasAt)(Gt,jt,Pt,(0,te.hm)(Ct)),ql=[...Kl].join(','),Yl=(0,H.useMemo)(()=>(0,de.floorView)(_t,It,kt,Ft??{},Ct,wt.settings.turnMins,Kl),[_t,It,kt,Ft,Ct.getTime(),ql]),Ql=(0,ve.hoursFor)(wt,Ct),Jl=Ql?.open??new Date(`${Pt}T12:00:00`),Xl=Ql?.close??new Date(`${Pt}T21:00:00`),Zl=(0,te.addMins)(Jl,-Jl.getMinutes()),es=(0,te.addMins)(Xl,30),ts=e=>new Date(`${Pt}T${e}:00`),ls=(0,Be.blocksOn)(Gt,jt,Pt).map(e=>({from:ts(e.from),to:ts(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Pt)),ss=Object.keys(Yl).filter(e=>'blocked'===Yl[e]?.status),is=ml&&ml!==Pt?ml:Pt,os=is!==Pt,ns=(0,He.dayWord)(is,Pt),as=/^(Today|Yesterday|Tomorrow)$/.test(ns),rs=os?(0,He.bookingsForDay)(It,is,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Fl,ds=(0,te.parseYmd)(is);ds.setHours(12);const cs=os?(0,ve.hoursFor)(wt,ds):Ql,us=cs?.open??new Date(`${is}T12:00:00`),hs=cs?.close??new Date(`${is}T21:00:00`),gs=e=>new Date(`${is}T${e}:00`),bs=[...os?(0,Be.blocksOn)(Gt,jt,is).map(e=>({from:gs(e.from),to:gs(e.to),label:e.reason??'Paused'})):ls,...os?(0,o.queuedServicePauses)(wt,ds,is):[]],ys=(0,o.queuedServiceSessions)(wt,ds),ps=s.IS_QUEUED_VENUE&&(void 0===ys||!ys.length),fs=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ys?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),xs=os?cs||rs.length?isos?(0,de.dayFloorView)(_t,rs,is):Yl,[os,_t,rs,is,Yl]),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),[Ss,Cs]=(0,H.useState)(null),Ts=os?rs.filter(e=>!['cancelled','noshow'].includes(e.status)):Gl,$s=Ts.reduce((e,t)=>e+t.partySize,0),Rs=(0,u.coversSplit)(Ts,is),Bs=(0,Me.cancelledDayTally)(It,is),Ls=(0,Ae.cancellationsFor)(It,is,e=>e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Ws=(0,Me.cancelledTallyWords)(Bs,as?ns.toLowerCase():os?`on ${ns}`:'today'),zs=Gt.filter(e=>e.rid===jt&&e.date===is&&!e.removedAt),Hs=(0,ze.chartBands)(zs,60*us.getHours()+us.getMinutes(),60*hs.getHours()+hs.getMinutes()),Ps=new Set((0,ze.blockedHours)(Hs)),Ms=Ct.getHours()+(Ct.getMinutes()>=30?1:0),As=Ul.hours.filter(e=>e.hour>=Ms&&!Ps.has(e.hour)),Es=As.reduce((e,t)=>e+t.coversHigh,0),Os=As.reduce((e,t)=>e+t.coversLow,0),Ns=Math.round((Os+Es)/2),_s=!Ul.example&&Ul.open&&Ul.enough&&Es>0?`Usually ${(0,c.coversRange)(Ns,Ns)} more`:void 0,Fs=async(e,t)=>{const l=Yl[e]?.booking;if(!l||e===t)return;const s=Yl[t]?.status;if(s&&!['free','soon'].includes(s))return void Pl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Pl,{b:l,tables:[t]}))return;await le.repo.bookings.update(l.id,{table:t});const i=Ft?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Pl(`Saving: ${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(l.id,`${(0,xe.privName)(l,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}`,Pl)},Gs=e=>{if(fl)return Is(null),void xl(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);os?ws(e):Zt?(e!==Zt&&Fs(Zt,e),el(null)):Xt(e)},Vs=fl?It.find(e=>e.id===fl.id):void 0,Us=fl&&Vs?(()=>{const e=Vs.walkIn?(0,xe.privName)(Vs,Ot):lt(Vs.name),t=(0,De.seatsOf)(_t,fl.tables).total,l=(0,De.seatLine)(t,Vs.partySize),s=(0,De.pickClashes)(Vs,fl.tables,It.filter(e=>e.date===Vs.date),wt.settings.turnMins),i=(0,De.tableKey)(fl.tables)!==(0,De.tableKey)((0,re.tablesOf)(Vs.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(Vs.date,Pt)} ${Vs.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(fl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(Vs.date,Pt)," ",Vs.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:se.colours.text,children:[(0,De.tablesWords)(fl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ks?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ks,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ks})}):null,Ds&&Vs&&fl.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,fl.tables.join('+')),onYes:()=>{vs(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,l,e,t,Pl)})()},onNo:()=>vs(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:ks?'plan-pick-overcap-yes':'plan-pick-save',label:ks?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ks?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(fl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Vs)return void xl(null);if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=(0,De.overCapacityAsk)(fl.tables,t,Vs.partySize);if(l&&!ks)return void Is(l);if('finished'===Vs.status&&fl.tables.length&&!Ds)return void vs(!0);Is(null),vs(!1);const s=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,s,e,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Is(null),xl(null)}})]})]})})():null,Ks=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),qs=e=>{const t=_t.tables.filter(t=>t.areaId===e);return os?`${t.filter(e=>!ms[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Yl[e.name]?.status??'free')).length}/${t.length} free`},Ys='all'===Yt||Ks.some(e=>e.id===Yt)?Yt:'all',Qs=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:ms,privacy:Ot,turnBase:wt.settings.turnMins,highlight:fl?fl.tables:Zt?[Zt]:void 0,onTap:e=>Gs(e.name),onDrop:(e,t)=>fl||os?void 0:Fs(e.name,t.name)}),Js=ut?1:ht||Ks.length>2?2:1,Xs=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=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)/l},Zs=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ti=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:qs(e.id)})]}),li=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(l-xt.h)>1)&&mt({w:t,h:l})},children:ei?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:ei.scroll,showsVerticalScrollIndicator:ei.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:ei.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:ei.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=Ks.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ei.cellW,gap:2},children:[ti(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:Qs(e)})]},e)})},t))}):null}),si=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Ys,onPress:()=>Qt('all')},"__all"),...Ks.map(e=>(0,Ye.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ut?Kl.has(e.id)?'closed':Ys===e.id?qs(e.id):void 0:void 0,selected:Ys===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;zl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>zl(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:Wl.view>0&&Wl.content>0&&Wl.content<=Wl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Wl.view>0&&Wl.content<=Wl.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),Us,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>el(null)})]}):null,'all'===Ys&>?li:'all'===Ys?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:Zs.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>Xs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:qs(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:qs(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*Xs(e.id)))}:{flex:1},children:Qs(e.id)})]},e.id)),e.length{if(os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},is)}),oi='timeline'===Vt,ni=Kt?(0,Ye.jsx)(F.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${os?(0,He.dayLong)(is):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),ps?fs:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:os?rs:Fl,now:os?us:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:os?(0,te.addMins)(us,-us.getMinutes()):Zl,t1:os?(0,te.addMins)(hs,30):es,pauses:os?bs:ls,blockedTables:os?[]:ss,onOpen:e=>{if(qt(!1),os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},`full-${is}`)})]})}):null,ai=os?(0,Ye.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:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:as?`Showing ${ns} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(is))}`:`Showing ${(0,He.dayWord)(is,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ws}. Showing ${(0,He.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{xl(null),Dl(null)},style:{minHeight:44}})]}):null,ri=(0,Ye.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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(oi||Kt);return(0,Ye.jsx)(V.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.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,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),di='display'===I.APP_VARIANT&&!e?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ri,(0,Ye.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:Rt,staff:Tt,today:Pt,leave:Bt})]}):ri,ci=(0,h.useBookingWrite)(),ui=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>nl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint})]});(0,qe.useDisplayNotices)(jt,!e);const hi=ut?180:168,[gi,bi]=(0,H.useState)(hi),yi=P.default.useRef(hi),pi=P.default.useRef(null),fi=P.default.useRef(null),xi=()=>{const e=pi.current,t=fi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=ct<820?8:12,o=44+(ct<820?4:8),n=i>yi.current?Math.ceil(i-yi.current):We.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(hi,Math.floor(t-s-l)-n-o));Math.abs(yi.current-a)>=2&&(yi.current=a,bi(a))})})};P.default.useEffect(()=>{const e=setTimeout(xi,60);return()=>clearTimeout(e)},[rt,ct]);const mi=(0,Ye.jsxs)(K.default,{ref:fi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),xi()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Nl(null),Al({at:Date.now()})},onHint:()=>Pl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(Le.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:is}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(Le.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ll(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),ji=Vl.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:se.colours.muted,children:[Vl.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Vl,me:zt,compact:!0,bookings:It})})]}):null,wi=(Oe.DueToday,wt.settings.turnMins||90),ki=os?rs:(0,v.todaysGuestList)(Fl,Ct,wi),Ii=os?[]:(0,v.todaysFinishedList)(Fl,Ct,wi),Di=os?as?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',vi=(0,Ye.jsxs)(Ye.Fragment,{children:[0===ki.length?(0,Ye.jsx)(Q.Muted,{children:os?is{const t=(0,v.isLeftEarly)(e,Ct,wi),l=(0,ie.isSeatedHighlight)(e.status,{otherDay:os})&&!t,s=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=se.colours.text,o=l?se.colours.goldLight:se.colours.muted,n=se.colours.gold,a=s.depositWarn?se.colours.amber:se.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:os?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(_.AllergyIcon,{text:s.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,s.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ii.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ii.length}${gl?', expanded':', collapsed'}`,accessibilityState:{expanded:gl},onPress:()=>bl(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ii.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:se.colours.muted,children:gl?'\u25be':'\u25b8'})]}),gl?Ii.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:ci.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Ee.CancellationsSection,{items:Ls,dayWord:os?as?ns.toLowerCase():`on ${ns}`:'today'})]}),Si=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:vi}),Ci=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&hl(!1)}}),Ti=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Di}, ${ki.length}`,accessibilityState:{expanded:ul},'aria-expanded':ul,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:ul?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:ul?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:se.colours.gold,children:ki.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Di," ",ul?'\u2039':'\u203a']})})})]}),$i=ul?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...Ci.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Di.toUpperCase()," (",ki.length,")"]}),(0,Ye.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Di}`,onPress:()=>hl(!1),style:{marginRight:-6}})]}),Bs.count?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Ws}):null]}),Si]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Di}`,accessibilityRole:"button",onPress:()=>hl(!1),style:{flex:1}})]}):null,Ri=ps?fs:s.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:rs,open:us,close:hs,now:Ct,turnBase:wt.settings.turnMins,blocks:zs,pauses:bs,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:hi,forecastNote:os?void 0:_s,emptyText:xs,past:is{Il.current=Date.now(),kl(!0)},shortDay:!ut&&rt<1100}),Wi=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:wl,today:Pt,day:is,bookings:It,restaurant:wt,now:Ct,onDay:Dl,onClose:()=>kl(!1)}),zi=()=>{os?hl(!0):qt(!0)},Hi=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ct<820?8:12,paddingTop:ct<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[Mt?null:Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:ai,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):oi?ii:si,ni,$i]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ui(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:di}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:ct<820,snug:ct<820,tight:ct<700,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{ref:pi,testID:"day-graph-slot",onLayout:xi,style:{flexGrow:0,flexShrink:1,flexBasis:hi+52,minHeight:ct<=600?90:120,overflow:'visible'},children:Bi}),(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),ji,(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Il.current=Date.now()},onMouseDown:()=>{Il.current=Date.now()},children:[ut?(0,Ye.jsxs)(K.default,{style:{flex:1},children:[(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt}),Li,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(ot,{phone:!0,split:Rs,items:[{label:`Tables \xb7 ${ns}`,value:Ts.length,testID:'badge-tables'},{label:`Covers \xb7 ${ns}`,value:$s,testID:'badge-covers'},{label:'Takeaway',value:Vl.length,alert:Vl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>il(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ui(!0)}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),di,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[oi?ii:si,ni]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Di," (",ki.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{gap:4},children:vi})]}),ji,Bi,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),mi]}),e?null:(0,Ye.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:se.colours.hairline},children:(0,Ye.jsx)(N.VoiceSlot,{size:56})})]}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ct<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ye.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Li}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,Ye.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.muted,children:"?"})}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,e?null:(0,Ye.jsx)(j.ExitButton,{}),ee,Ue?null:(0,Ye.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,!I.IS_CAR&&Mt?(0,Ye.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(ot,{splitOnly:!0,split:Rs,items:[]})})]})}),gt?Hi:(Pi=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ui(!1)}),di]}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[ai,oi?ii:si,ni,$i]})]})}),ji,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:hi+We.DAY_GRAPH_CHROME},children:Bi})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Pi})),mi]}),(0,Ye.jsx)(R.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ll(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Bl,onClose:()=>Ll(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ol?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>nl(!1)}):null,al?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:al,who:zt,onClose:()=>rl(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Yl,plan:_t,todays:Fl,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>el(e),onDetails:_l}):null,js?(()=>{const e=ms[js],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Cs(null),ws(null)},title:`${(0,d.tableNumbersA11y)(js)} \xb7 ${as?ns:(0,He.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${as?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${as?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Ot):lt(e.name);return(0,Ye.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ws(null),pl(e.id)},style:{minHeight:56}},e.id)}),is>=Pt?(()=>{const t=e?.table.maxSeats??0,l=It.filter(e=>e.date===is&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(js)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(js)]}),Ss?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Ss.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Ss.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ci.ok,accessibilityHint:ci.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Ss.id);if(Cs(null),!e)return;const l=lt(e.name);ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Cs(null)})]})]}):null,Ss?null:l.slice(0,12).map(e=>{const l=lt(e.name),s=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ci.ok,accessibilityHint:ci.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(js)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:e,tables:[js]}))return;const s=(0,De.overCapacityAsk)([js],t,e.partySize);s?Cs({id:e.id,ask:s}):(ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Cs(null),ws(null)},style:{minHeight:56}})]})})():null,yl?(()=>{const e=It.find(e=>e.id===yl);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Ot):lt(e.name),view:Yl,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>pl(null),onDetails:_l,onDone:Pl,onEdit:e=>{pl(null),rl(e.id)},onPickOnPlan:(e,t)=>{hl(!1),Ut('plan'),Qt('all'),xl({id:e.id,tables:t})}}):null})():null,tl?(0,Ye.jsx)(Se.DetailsPanel,{title:tl.title,onClose:()=>ll(null),children:tl.body}):null,Wi,dl?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Fl,orders:kt,waitlistAll:vl,walkInCount:Sl,onClose:()=>cl(!1)}):null,Cl?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Tl(!1)})]}):null,$l?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Rl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Rl(!1)})]}):null,sl?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>il(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Vl,me:zt,bookings:It})]}):null,Ml?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{El.current=Date.now(),null!==Ol&&Nl(null)},notice:null!==Ol?`Locking again in ${Ol} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Al(null),Pl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Pl('Live seating plan updated on every screen.')},onCancel:()=>{Al(null),Pl('No changes kept. Editing is locked again.')}},Ml.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)($e.TakeawayTakeover,{rid:jt,me:zt})]});var Pi}function dt({rid:e,id:t,turnBase:l}){const s=(0,le.useBookings)(e).find(e=>e.id===t);return s?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1334,[1069,797,5,6,1335,829,854,1108,861,1155,1336,1337,1338,1105,1135,1339,1340,1345,1346,1215,1347,873,1352,1353,1354,1128,1127,977,1355,1167,950,1118,1356,35,1088,1189,1027,1101,1151,1357,396,381,403,296,103,427,37,795,1231,1235,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1358,1122,1359,1366,1368,1371,1376,1370,1377,1379,1380,1130,1109,1110,879,1385,1220,1386,1230,1222,1004,1391,1396,1397,1070,1068,1132,1399,1400,1401,1087,1182,1402,1181,1174,870,1348,1403,26]); +__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,qe.jsx)(rt,{...e}):(0,qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Q.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]),o=_r(_d[4]),n=_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]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_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]),H=_r(_d[32]),z=_r(_d[33]),M=e(z),P=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_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])),Y=e(_r(_d[45])),q=_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]),oe=_r(_d[56]),ne=_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]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_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]),He=_r(_d[85]),ze=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_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]),Ye=_r(_d[99]),qe=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?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)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,qe.jsx)(Q.T,{size:s?14:12,colour:le.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)(M.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||o?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)(Q.T,{size:14,colour:le.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)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Q.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:le.colours.gold},children:[(0,qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){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:n?4:7,minHeight:44,paddingHorizontal:n?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:[o?(0,qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,qe.jsx)(Q.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.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:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,qe.jsx)(Q.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)(Q.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)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,Y.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=M.default.useRef(null),xt=M.default.useRef(0),[ft,mt]=(0,z.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const kt=(0,se.useOrders)(jt),It=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),Rt=(0,oe.useOwner)(e=>e.attendance),$t=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Wt=M.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);M.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Mt=(0,te.ymd)(Ct),Pt=(0,A.useTravelDay)('display',Mt),At=(0,ne.useFrontDoor)(Mt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,xe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,z.useState)('plan'),[Kt,Yt]=(0,z.useState)(!1),[qt,Qt]=(0,z.useState)('all'),[Jt,Xt]=(0,z.useState)(null),[Zt,es]=(0,z.useState)(null),[ts,ss]=(0,z.useState)(null),[ls,is]=(0,z.useState)(!1),[os,ns]=(0,z.useState)(!1),[as,rs]=(0,z.useState)(null),[ds,cs]=(0,z.useState)(!1),[us,hs]=(0,z.useState)(!1),[gs,bs]=(0,z.useState)(!1),[ys,ps]=(0,z.useState)(null),[xs,fs]=(0,z.useState)(null),[ms,js]=(0,z.useState)(null),[ws,ks]=(0,z.useState)(!1),Is=M.default.useRef(0),Ds=e=>{Is.current=Date.now(),js(e)};M.default.useEffect(()=>{if(!ms)return;const e=setInterval(()=>{Date.now()-Is.current>=ze.DAY_IDLE_MS&&js(null)},5e3);return()=>clearInterval(e)},[ms]);const vs=(0,se.useWaitlist)(jt),Ss=(0,se.useStore)(e=>e.walkIns[jt]??0),[Cs,Ts]=(0,z.useState)(!1),[Rs,$s]=(0,z.useState)(!1),[Bs,Ws]=(0,z.useState)(!1),[Ls,Hs]=(0,z.useState)(!1);(0,X.useReviewAlerts)(jt);const[zs,Ms]=(0,z.useState)({view:0,content:0}),[Ps,As]=(0,z.useState)(null);M.default.useEffect(()=>{Ps&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Ps,timeoutMs:4500,big:!0,testID:'floor-toast'}),As(null))},[Ps]),M.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Es,Os]=(0,z.useState)(null),Ns=M.default.useRef(0),[_s,Gs]=(0,z.useState)(null);M.default.useEffect(()=>{if(!Es)return;Ns.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Ns.current;if(e>=Xe)return Os(null),void As('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Gs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Fs=e=>e.date!==Mt?ss({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Mt)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!hi.ok,accessibilityHint:hi.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),As(e)}}):null,e.walkIn?(0,qe.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Mt,onDone:e=>{ss(null),As(e)}}):null,(0,Se.bookingDetails)(e)]})}),Vs=It.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Us=Vs.filter(e=>!['cancelled','noshow'].includes(e.status)),Ks=kt.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,z.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),qs=(0,Be.closedAreasAt)(Ft,jt,Mt,(0,te.hm)(Ct)),Qs=[...qs].join(','),Js=(0,z.useMemo)(()=>(0,de.floorView)(_t,It,kt,Gt??{},Ct,wt.settings.turnMins,qs),[_t,It,kt,Gt,Ct.getTime(),Qs]),Xs=(0,ve.hoursFor)(wt,Ct),Zs=Xs?.open??new Date(`${Mt}T12:00:00`),el=Xs?.close??new Date(`${Mt}T21:00:00`),tl=(0,te.addMins)(Zs,-Zs.getMinutes()),sl=(0,te.addMins)(el,30),ll=e=>new Date(`${Mt}T${e}:00`),il=(0,Be.blocksOn)(Ft,jt,Mt).map(e=>({from:ll(e.from),to:ll(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Mt)),ol=Object.keys(Js).filter(e=>'blocked'===Js[e]?.status),nl=ms&&ms!==Mt?ms:Mt,al=nl!==Mt,rl=(0,ze.dayWord)(nl,Mt),dl=/^(Today|Yesterday|Tomorrow)$/.test(rl),cl=al?(0,ze.bookingsForDay)(It,nl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):Vs,ul=(0,te.parseYmd)(nl);ul.setHours(12);const hl=al?(0,ve.hoursFor)(wt,ul):Xs,gl=hl?.open??new Date(`${nl}T12:00:00`),bl=hl?.close??new Date(`${nl}T21:00:00`),yl=e=>new Date(`${nl}T${e}:00`),pl=[...al?(0,Be.blocksOn)(Ft,jt,nl).map(e=>({from:yl(e.from),to:yl(e.to),label:e.reason??'Paused'})):il,...al?(0,o.queuedServicePauses)(wt,ul,nl):[]],xl=(0,o.queuedServiceSessions)(wt,ul),fl=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),ml=(0,qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),jl=al?hl||cl.length?nlal?(0,de.dayFloorView)(_t,cl,nl):Js,[al,_t,cl,nl,Js]),[kl,Il]=(0,z.useState)(null),[Dl,vl]=(0,z.useState)(null),[Sl,Cl]=(0,z.useState)(!1),[Tl,Rl]=(0,z.useState)(null),$l=al?cl.filter(e=>!['cancelled','noshow'].includes(e.status)):Us,Bl=$l.reduce((e,t)=>e+t.partySize,0),Wl=(0,u.coversSplit)($l,nl),Ll=(0,Pe.cancelledDayTally)(It,nl),Hl=(0,Ae.cancellationsFor)(It,nl,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),zl=(0,Pe.cancelledTallyWords)(Ll,dl?rl.toLowerCase():al?`on ${rl}`:'today'),Ml=Ft.filter(e=>e.rid===jt&&e.date===nl&&!e.removedAt),Pl=(0,He.chartBands)(Ml,60*gl.getHours()+gl.getMinutes(),60*bl.getHours()+bl.getMinutes()),Al=new Set((0,He.blockedHours)(Pl)),El=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Ol=Ys.hours.filter(e=>e.hour>=El&&!Al.has(e.hour)),Nl=Ol.reduce((e,t)=>e+t.coversHigh,0),_l=Ol.reduce((e,t)=>e+t.coversLow,0),Gl=Math.round((_l+Nl)/2),Fl=!Ys.example&&Ys.open&&Ys.enough&&Nl>0?`Usually ${(0,c.coversRange)(Gl,Gl)} more`:void 0,Vl=async(e,t)=>{const s=Js[e]?.booking;if(!s||e===t)return;const l=Js[t]?.status;if(l&&!['free','soon'].includes(l))return void As('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(As,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),As(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,As)},Ul=e=>{if(xs)return vl(null),void fs(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);al?Il(e):Zt?(e!==Zt&&Vl(Zt,e),es(null)):Xt(e)},Kl=xs?It.find(e=>e.id===xs.id):void 0,Yl=xs&&Kl?(()=>{const e=Kl.walkIn?(0,fe.privName)(Kl,Ot):st(Kl.name),t=(0,De.seatsOf)(_t,xs.tables).total,s=(0,De.seatLine)(t,Kl.partySize),l=(0,De.pickClashes)(Kl,xs.tables,It.filter(e=>e.date===Kl.date),wt.settings.turnMins),i=(0,De.tableKey)(xs.tables)!==(0,De.tableKey)((0,re.tablesOf)(Kl.table));return(0,qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Kl.date,Mt)} ${Kl.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Kl.date,Mt)," ",Kl.time]}),(0,qe.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Dl?(0,qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Dl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,qe.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Dl})}):null,Sl&&Kl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Cl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,s,e,t,As)})()},onNo:()=>Cl(!1)}):null,(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:Dl?'plan-pick-overcap-yes':'plan-pick-save',label:Dl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Dl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Kl)return void fs(null);if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=(0,De.overCapacityAsk)(xs.tables,t,Kl.partySize);if(s&&!Dl)return void vl(s);if('finished'===Kl.status&&xs.tables.length&&!Sl)return void Cl(!0);vl(null),Cl(!1);const l=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,l,e,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),fs(null)}})]})]})})():null,ql=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),Ql=e=>{const t=_t.tables.filter(t=>t.areaId===e);return al?`${t.filter(e=>!wl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Js[e.name]?.status??'free')).length}/${t.length} free`},Jl='all'===qt||ql.some(e=>e.id===qt)?qt:'all',Xl=e=>(0,qe.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:wl,privacy:Ot,turnBase:wt.settings.turnMins,highlight:xs?xs.tables:Zt?[Zt]:void 0,onTap:e=>Ul(e.name),onDrop:(e,t)=>xs||al?void 0:Vl(e.name,t.name)}),Zl=ut?1:ht||ql.length>2?2:1,ei=e=>{const t=_t.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},ti=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),ft.w,ft.h):null,li=e=>(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:Ql(e.id)})]}),ii=(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-ft.w)>1||Math.abs(s-ft.h)>1)&&mt({w:t,h:s})},children:si?(0,qe.jsx)(U.default,{style:{flex:1},scrollEnabled:si.scroll,showsVerticalScrollIndicator:si.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:si.rows.map((e,t)=>(0,qe.jsx)(K.default,{style:{height:si.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=ql.find(t=>t.id===e);return(0,qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:si.cellW,gap:2},children:[li(t),(0,qe.jsx)(K.default,{style:{flex:1},children:Xl(e)})]},e)})},t))}):null}),oi=(0,qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:_t}),_t.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)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Q.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)(Q.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)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Jl,onPress:()=>Qt('all')},"__all"),...ql.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?qs.has(e.id)?'closed':Jl===e.id?Ql(e.id):void 0:void 0,selected:Jl===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(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;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(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:zs.view>0&&zs.content>0&&zs.content<=zs.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:zs.view>0&&zs.content<=zs.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),Yl,Zt?(0,qe.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,qe.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===Jl&>?ii:'all'===Jl?(0,qe.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ti.map((e,t)=>(0,qe.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ei(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{center:!0,children:Ql(e.id)})]}):(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{children:Ql(e.id)})]}),(0,qe.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ei(e.id)))}:{flex:1},children:Xl(e.id)})]},e.id)),e.length{if(al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},nl)}),ai='timeline'===Vt,ri=Kt?(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:le.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:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.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)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${al?(0,ze.dayLong)(nl):'Today'}`})}),rt<600?null:(0,qe.jsx)(K.default,{style:{minWidth:180}})]}),fl?ml:(0,qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:al?cl:Vs,now:al?gl:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:al?(0,te.addMins)(gl,-gl.getMinutes()):tl,t1:al?(0,te.addMins)(bl,30):sl,pauses:al?pl:il,blockedTables:al?[]:ol,onOpen:e=>{if(Yt(!1),al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},`full-${nl}`)})]})}):null,di=al?(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:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:dl?`Showing ${rl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(nl))}`:`Showing ${(0,ze.dayWord)(nl,Mt)}`}),(0,qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${zl}. Showing ${(0,ze.dayLong)(nl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{fs(null),Ds(null)},style:{minHeight:44}})]}):null,ci=(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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(ai||Kt);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?(Ut('plan'),Yt(!0)):(Yt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.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)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ui='display'===I.APP_VARIANT&&!e?(0,qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ci,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:$t,staff:Tt,today:Mt,leave:Bt})]}):ci,hi=(0,h.useBookingWrite)(),gi=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint})]});(0,Ye.useDisplayNotices)(jt,!e);const bi=!e&&!I.IS_CAR&&!ut,yi=ut?180:202,[pi,xi]=(0,z.useState)(ut?180:168),fi=M.default.useRef(ut?180:168),mi=M.default.useRef(null),ji=M.default.useRef(null),wi=M.default.useRef(null),ki=!ut&&ct<=800,Ii=()=>{const e=mi.current,t=ji.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l)=>{const i=t>fi.current?Math.ceil(t-fi.current):0,o=Math.max(Le.DAY_GRAPH_CHROME+(ki?24:8),i),n=!ut&&ct>=700?140:70,a=Math.floor(s-4-e)-o-l,r=Math.min(yi,a>=n?Math.max(n,a):Math.max(0,a));Math.abs(fi.current-r)>=2&&(fi.current=r,xi(r))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,o,n,a)=>{t.measureInWindow((e,t)=>{const n=wi.current;bi&&n?.measureInWindow?n.measureInWindow((e,l,n,r)=>{const d=ct<820?4:8;s(o,a,t,Math.max(i,44+d+Math.round(r||0)))}):s(o,a,t,bi?i:l)})})};M.default.useEffect(()=>{const e=setTimeout(Ii,60);return()=>clearTimeout(e)},[rt,ct]);const Di=(0,qe.jsxs)(K.default,{ref:ji,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ii()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:ki?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ke.DisplayClockButton,{}),(0,qe.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Gs(null),Os({at:Date.now()})},onHint:()=>As('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:Ht,quiet:!0,display:!0,day:nl}),_t.areas.some(e=>e.outdoor)?(0,qe.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,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:()=>Hs(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(x.GiftQrButton,{rid:jt,venue:wt.name})]}),vi=Ks.length?(0,qe.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ks.length," live"]})]}),(0,qe.jsx)(K.default,{style:{padding:10},children:(0,qe.jsx)(at,{list:Ks,me:Ht,compact:!0,bookings:It})})]}):null,Si=(Oe.DueToday,wt.settings.turnMins||90),Ci=al?cl:(0,v.todaysGuestList)(Vs,Ct,Si),Ti=al?[]:(0,v.todaysFinishedList)(Vs,Ct,Si),Ri=al?dl?`${rl}\u2019s guests`:`Guests ${rl}`:'Today\u2019s guests',$i=(0,qe.jsxs)(qe.Fragment,{children:[0===Ci.length?(0,qe.jsx)(Q.Muted,{children:al?nl{const t=(0,v.isLeftEarly)(e,Ct,Si),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:al})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,o=s?le.colours.goldLight:le.colours.muted,n=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:al?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:l.time}),(0,qe.jsx)(Q.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)(_.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,qe.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?o:i,children:l.table}),l.dog?(0,qe.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ti.length?(0,qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ti.length}${gs?', expanded':', collapsed'}`,accessibilityState:{expanded:gs},onPress:()=>bs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",Ti.length,")"]}),(0,qe.jsx)(Q.T,{size:16,colour:le.colours.muted,children:gs?'\u25be':'\u25b8'})]}),gs?Ti.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(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:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Q.T,{size:15,colour:le.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:jt,today:Mt,who:t.name,allowed:hi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ee.CancellationsSection,{items:Hl,dayWord:al?dl?rl.toLowerCase():`on ${rl}`:'today'})]}),Bi=(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:$i}),Wi=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&&hs(!1)}}),Li=(0,qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ri}, ${Ci.length}`,accessibilityState:{expanded:us},'aria-expanded':us,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:Ci.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)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[Ri," ",us?'\u2039':'\u203a']})})})]}),Hi=us?(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",...Wi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.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,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Ri.toUpperCase()," (",Ci.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Ri}`,onPress:()=>hs(!1),style:{marginRight:-6}})]}),Ll.count?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:zl}):null]}),Bi]}),(0,qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ri}`,accessibilityRole:"button",onPress:()=>hs(!1),style:{flex:1}})]}):null,zi=fl?ml:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:cl,open:gl,close:bl,now:Ct,turnBase:wt.settings.turnMins,blocks:Ml,pauses:pl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?pi:yi,forecastNote:al?void 0:Fl,emptyText:jl,past:nl{Is.current=Date.now(),ks(!0)},shortDay:!ut&&rt<1100}),Ai=(0,qe.jsx)(Me.DisplayCalendar,{visible:ws,today:Mt,day:nl,bookings:It,restaurant:wt,now:Ct,onDay:Ds,onClose:()=>ks(!1)}),Ei=()=>{al?hs(!0):Yt(!0)},Oi=(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ki?4:ct<820?8:12,paddingTop:ki?bi?2:4:ct<820?bi?4:6:bi?8:10,gap:ki?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:di,Pt?(0,qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,today:Mt,app:"display"})}):ai?ni:oi,ri,Hi]}),(0,qe.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:gi(!1)}),(0,qe.jsx)(K.default,{style:{flexShrink:0},children:ui}),Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:ct<820,snug:ct<820,tight:ct<800,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{ref:mi,testID:"day-graph-slot",onLayout:Ii,style:{flexGrow:0,flexShrink:1,flexBasis:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),height:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),minHeight:ct<=600?90:Math.min((ut?yi:pi)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:Mi}),(0,qe.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[bi?null:(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),vi,(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht})]}),bi&&!Pt?(0,qe.jsx)(K.default,{ref:wi,testID:"display-side-split",style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})}):null]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{Is.current=Date.now()},onMouseDown:()=>{Is.current=Date.now()},children:[ut?(0,qe.jsxs)(K.default,{style:{flex:1},children:[(0,qe.jsxs)(U.default,{ref:pt,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)(Z.RestaurantLogo,{rid:jt,size:64}),(0,qe.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,qe.jsx)(Z.PoweredBy,{}),(0,qe.jsx)(H.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,qe.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:"m"}),(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt}),Pi,(0,qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(ot,{phone:!0,split:Wl,items:[{label:`Tables \xb7 ${rl}`,value:$l.length,testID:'badge-tables'},{label:`Covers \xb7 ${rl}`,value:Bl,testID:'badge-covers'},{label:'Takeaway',value:Ks.length,alert:Ks.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:gi(!0)}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),ui,(0,qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ai?ni:oi,ri]}),(0,qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[Ri," (",Ci.length,")"]}),(0,qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{gap:4},children:$i})]}),vi,Mi,(0,qe.jsx)(K.default,{testID:"covers-dock",children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.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)(Q.T,{center:!0,size:14,colour:Ot?le.colours.muted:le.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,qe.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Di]}),e?null:(0,qe.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:le.colours.hairline},children:(0,qe.jsx)(N.VoiceSlot,{size:56})})]}):(0,qe.jsxs)(qe.Fragment,{children:[bi?(0,qe.jsxs)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,n.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.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})}),(0,qe.jsx)(V.default,{testID:"display-more",accessibilityRole:"button",accessibilityLabel:"More",onPress:()=>Ws(!0),style:({pressed:e})=>({minWidth:44,height:44,marginLeft:8,paddingHorizontal:10,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center',flexShrink:0}),children:(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.muted,children:"More"})})]}):null,(0,qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ki?2:ct<820?4:8,gap:8,minHeight:ki&&bi?44:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,qe.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Pt?(0,qe.jsx)(K.default,{style:{width:220}}):(0,qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Pi}),(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:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Pt?null:(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,qe.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.muted,children:"?"})}),'simulated'===St?(0,qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,e?null:(0,qe.jsx)(j.ExitButton,{}),ee,Ue?null:(0,qe.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,I.IS_CAR||!Pt||bi?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Pt||bi?null:(0,qe.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,qe.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(K.default,{style:tt,children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})})]})}),gt?Oi:(Ni=(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:gi(!1)}),ui]}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),Pt?(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,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:[Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[di,ai?ni:oi,ri,Hi]})]})}),vi,Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:yi+Le.DAY_GRAPH_CHROME},children:Mi})]}),(0,qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Ni})),Di]}),(0,qe.jsx)($.SoldOutStrip,{rid:jt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:Ls,onClose:()=>Hs(!1),rid:jt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:jt}),At.elements,os?(0,qe.jsx)(y.EditBookingPicker,{rid:jt,today:Mt,who:Ht,onClose:()=>ns(!1)}):null,as?(0,qe.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:Ht,onClose:()=>rs(null)}):null,Jt?(0,qe.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Js,plan:_t,todays:Vs,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Fs}):null,kl?(()=>{const e=wl[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Rl(null),Il(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${dl?rl:(0,ze.dayLong)(nl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${dl?rl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${dl?rl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):st(e.name);return(0,qe.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Il(null),ps(e.id)},style:{minHeight:56}},e.id)}),nl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===nl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(kl)).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)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Tl?(0,qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Tl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Tl.ask}),(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!hi.ok,accessibilityHint:hi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Tl.id);if(Rl(null),!e)return;const s=st(e.name);Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Rl(null)})]})]}):null,Tl?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,qe.jsx)(Q.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:!hi.ok,accessibilityHint:hi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(As,{b:e,tables:[kl]}))return;const l=(0,De.overCapacityAsk)([kl],t,e.partySize);l?Rl({id:e.id,ask:l}):(Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Rl(null),Il(null)},style:{minHeight:56}})]})})():null,ys?(()=>{const e=It.find(e=>e.id===ys);return e?(0,qe.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):st(e.name),view:Js,now:Ct,otherDay:e.date!==Mt,turnBase:wt.settings.turnMins,onClose:()=>ps(null),onDetails:Fs,onDone:As,onEdit:e=>{ps(null),rs(e.id)},onPickOnPlan:(e,t)=>{hs(!1),Ut('plan'),Qt('all'),fs({id:e.id,tables:t})}}):null})():null,ts?(0,qe.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,Ai,ds?(0,qe.jsx)(Se.ServiceSummary,{r:wt,todays:Vs,orders:kt,waitlistAll:vs,walkInCount:Ss,onClose:()=>cs(!1)}):null,Cs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ts(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ts(!1)})]}):null,Bs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ws(!1),$s(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,Rs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,ls?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,qe.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(at,{list:Ks,me:Ht,bookings:It})]}):null,Es?(0,qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,qe.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Ns.current=Date.now(),null!==_s&&Gs(null)},notice:null!==_s?`Locking again in ${_s} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Os(null),As('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),As('Live seating plan updated on every screen.')},onCancel:()=>{Os(null),As('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,qe.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,qe.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,qe.jsx)(Re.TakeawayTakeover,{rid:jt,me:Ht})]});var Ni}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1334,[1069,797,5,6,1335,829,854,1108,861,1155,1336,1337,1338,1105,1135,1339,1340,1345,1346,1215,1347,873,1352,1353,1354,1128,1127,977,1355,1167,950,1118,1356,35,1088,1189,1027,1101,1151,1357,396,381,403,296,103,427,37,795,1231,1235,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1358,1122,1359,1366,1368,1371,1376,1370,1377,1379,1380,1130,1109,1110,879,1385,1220,1386,1230,1222,1004,1391,1396,1397,1070,1068,1132,1399,1400,1401,1087,1182,1402,1181,1174,870,1348,1403,26]); __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},1336,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1337,[1005,1073]); @@ -1476,7 +1476,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";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}:{}}))}},1393,[]); __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)}},1394,[879,859,878]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1395,[5,1007,904,958]); -__d(function(g,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,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:w,blocks:M=[],height:v=150,forecastNote:k,emptyText:$,past:D,closed:A,compact:I=!1,dense:C=!1,bare:L=!1,fill:_=!1,fit:z=!1,tight:H=!1,live:O=!1}){const[S,F]=(0,t.useState)(0),[P,R]=(0,t.useState)(0),N=j.getTime()-18e5,B=T.getTime()+36e5,E=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(N),new Date(B),w),[e,N,B,w]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(M,W,X),[M,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=z&&P?Math.max(24,Math.floor(P)):Math.max(48,v-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=C?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:O,past:D,closed:A}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},he=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),de=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&de.push(t.getTime())}const ue=O?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),xe=A?null:O?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,ge=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:de,busiest:xe}):{hours:[],busiest:null},me=he(E),pe=le?he(ae.before):me,fe=le?he(ae.after):'',ye=_&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,we=ge.busiest?.text??(A?'':O?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),Me=U.map(e=>e.spoken).join('. '),ve=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${we?` ${we}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${ve} percent of the way through the day.`:''}${Me?` ${Me}.`:''}`,$e=(0,u.hm)(b),De=Math.max(44,12*$e.length*.7+16),Ae=Math.max(q+2,Math.min(Math.max(0,S-J-De),se(re)-De/2)),Ie=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,z?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:L?4:C?2:10,paddingBottom:L?2:6,backgroundColor:c.colours.bg}],children:[L?null:I?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),L||H?null:A?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ke,onLayout:e=>{F(e.nativeEvent.layout.width),z&&R(e.nativeEvent.layout.height)},style:z?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,v-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,A?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,ge.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:ge.busiest.x+ge.busiest.w/2,y:ge.busiest.y+ge.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:ge.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Ae,top:Ie,minWidth:De,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),ge.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':i(0,f.coverCurve)(e,new Date(N),new Date(B),v),[e,N,B,v]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(w,W,X),[w,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=O&&P?Math.max(24,Math.floor(P)):Math.max(48,M-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=A?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:$,closed:I}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},de=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),he=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&he.push(t.getTime())}const ue=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),ge=I?null:H?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,xe=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:he,busiest:ge}):{hours:[],busiest:null},me=de(E),pe=le?de(ae.before):me,fe=le?de(ae.after):'',ye=z&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ve=xe.busiest?.text??(I?'':H?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),we=U.map(e=>e.spoken).join('. '),Me=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=!I&&K&&K.covers?(0,m.peakOccupancyText)(K.t,K.covers):'',De=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${ke?` ${ke}.`:''}${ve?` ${ve}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${Me} percent of the way through the day.`:''}${we?` ${we}.`:''}`,$e=(0,u.hm)(b),Ie=Math.max(44,12*$e.length*.7+16),Le=Math.max(q+2,Math.min(Math.max(0,S-J-Ie),se(re)-Ie/2)),Ae=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[h.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:C?4:A?2:10,paddingBottom:C?2:6,backgroundColor:c.colours.bg}],children:[C?null:L?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te}),ke?(0,y.jsx)(d.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:ke}):null]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:A?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),C||_?null:I?k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),ke&&!L?(0,y.jsx)(d.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:ke}):k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),C||_||L||!k||!ke?null:(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),C||!_||!ke||L?null:(0,y.jsx)(d.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:ke}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:De,onLayout:e=>{F(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,xe.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:xe.busiest.x+xe.busiest.w/2,y:xe.busiest.y+xe.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:xe.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(d.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Le,top:Ae,minWidth:Ie,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(d.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),xe.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1397,[]); __d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1398,[1092]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1399,[861,1378]); diff --git a/display-app/admin.html b/display-app/admin.html index e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 9294cbf6761fd1a7bea2deb97d4ac4ef35daa2ea..db9a40b0ef7537590a55c6eca66130cb2103542c 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 268485ac2ab4433f194de209909ce3e0df017e53..1f5ec5bec3c9e2012e62c4fc8fb5c58e28f18e15 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-dded36fffb"; +const V = "cc-display-6c41ab4a17"; 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=dded36fffbfc55c18da18245941035926818bad8918d03112f17d2f0e510f9d4"]; +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=6c41ab4a17cc69d681d94144c8c386bda8a80513731b96bf977d8b631fa198ec"]; // 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 e1fdacd97d2e5722459ee0f708c770c4ad17339b..da633f68727bb6f6f030178f47f125f099f6cc69 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 1c06fab4e5c11bd673e1f1e75288acfbb0a7d5c4..380c9c84d2b3897dc532b372ca4819aad0ddc52a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Cover Charge: try the apps (v0.3.12.189) +Cover Charge: try the apps (v0.3.12.190) @@ -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.189)

+

Cover Charge: try the apps (v0.3.12.190)

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.189

+

Cover Charge v0.3.12.190

diff --git a/owner-app/_expo/static/js/web/bundle.js b/owner-app/_expo/static/js/web/bundle.js index 5af413602243a141c52825eb579e7ac76bef5a09..3d140983b79742716b44b5b27761c0043581698c 100644 --- a/owner-app/_expo/static/js/web/bundle.js +++ b/owner-app/_expo/static/js/web/bundle.js @@ -5,7 +5,7 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() !(function(r){let l=0,n=!0===r.RN$useAlwaysAvailableJSErrorHandling?r.RN$handleException:(r,l)=>{throw r};const t={setGlobalHandler(r){n=r},getGlobalHandler:()=>n,reportError(r){n&&n(r,!1)},reportFatalError(r){n&&n(r,!0)},applyWithGuard(r,n,e,a,o){try{return l++,r.apply(n,e)}catch(r){t.reportError(r)}finally{l--}return null},applyWithGuardIfNeeded:(r,l,n)=>t.inGuard()?r.apply(l,n):(t.applyWithGuard(r,l,n),null),inGuard:()=>!!l,guard(r,l,n){if('function'!=typeof r)return console.warn('A function must be passed to ErrorUtils.guard, got ',r),null;const e=l??r.name??'';return function(...l){return t.applyWithGuard(r,n??this,l,null,e)}}};r.ErrorUtils=t})('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof global?global:'undefined'!=typeof window?window:this); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,20]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&!t.PITCH_ANCHORAGE&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=o=>{if(3===o.nodeType){const e=o.nodeValue??'',a=(0,n.pitchText)(e,t.PITCH_ANCHORAGE);return void(a!==e&&(o.nodeValue=a))}if(1!==o.nodeType)return;const a=o;if('INPUT'===a.tagName||'TEXTAREA'===a.tagName){const e=a,o=(0,n.pitchText)(e.value,t.PITCH_ANCHORAGE);o!==e.value&&(e.value=o);const i=e.getAttribute('placeholder');if(i){const o=(0,n.pitchText)(i,t.PITCH_ANCHORAGE);o!==i&&e.setAttribute('placeholder',o)}}for(const e of['aria-label','title']){const o=a.getAttribute(e);if(o){const i=(0,n.pitchText)(o,t.PITCH_ANCHORAGE);i!==o&&a.setAttribute(e,i)}}a.childNodes.forEach(e)},o=()=>{e(document.body),document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE),new MutationObserver(o=>{for(const t of o)'characterData'===t.type?e(t.target):t.addedNodes.forEach(e),'attributes'===t.type&&e(t.target);document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?o():document.addEventListener('DOMContentLoaded',o)}}},1,[2,3,16,18,19]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!0},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!1},2,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return c.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return R}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]);const u={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[6]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},h={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},f={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},b={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},p=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:f,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...u,orderAtTable:!1,pay:h,cashUpRecord:[...l.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:8,bookingNoticeMins:15,autoAcceptUpTo:8},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...u,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],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']},settings:{...u,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],A={by:'Fictional demo',at:'2026-10-26'},T=(t,n,o,s,c,l,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:c,price:l,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:A}),R=[T('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),T('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),T('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),T('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),T('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),T('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),T('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),T('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),T('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),T('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13,15]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="anchorage".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); @@ -1070,7 +1070,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()})},987,[35,988]); __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},988,[985,948,989]); __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'}},989,[985]); -__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.189'},990,[]); +__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.190'},990,[]); __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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},991,[992,993,904,948,988]); __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())}}}},993,[948]); @@ -1244,7 +1244,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 e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1161,[35,403,103,795,868,822,1154,1153,1158,1011,26]); __d(function(g,_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.ChefForecast=function({openPrep:e}){const{r:f,rid:y,now:b}=(0,u.useChef)(6e4),x=(0,l.useBookings)(y),p=(0,l.useOrders)(y),j=(0,l.useEvents)(y),k=(0,a.useRealHistory)(y,b),w=(0,d.ymd)(b),[T,$]=(0,o.useState)(7),{covers:v,enough:C,booked:D,pct:I,day:A,example:L}=(0,u.useForecast)(),M=0===I?`about a usual ${A}`:`${Math.abs(I)}% ${I>0?'busier':'quieter'} than a usual ${A}`,z=(0,o.useMemo)(()=>Array.from({length:T},(e,o)=>{const s=0===o?b:(0,d.addMins)((0,d.parseYmd)(w),1440*o),t=(0,i.forecastToday)(f,x,p,j,s,k??void 0);return{d:s,f:t,booked:t.hours.reduce((e,o)=>e+o.booked,0),covers:t.hours.reduce((e,o)=>e+o.covers,0)}}),[f,x,p,j,w,T,k,b.getTime()/6e5|0]),B=z[0].f,R=z.map(e=>({key:(0,d.ymd)(e.d),label:(0,d.dayShort)(e.d),spoken:(0,d.dayLong)(e.d),value:e.f.open?C?e.covers:e.booked:0,open:!!e.f.open}));return(0,h.jsxs)(t.default,{style:{gap:12},testID:"chef-forecast",children:[(0,h.jsx)(r.Muted,{center:!0,testID:"chef-forecast-busy",children:B.busy.words}),C?null:(0,h.jsx)(a.NotEnoughHistory,{weeks:B.minWeeks,booked:D}),(0,h.jsxs)(r.Card,{children:[(0,h.jsxs)(t.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,h.jsxs)(r.T,{center:!0,weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:[7===T?'This week':`Next ${T} days`," \xb7 ",C?'forecast covers':'booked covers']}),C?B.example?(0,h.jsx)(a.ExampleBadge,{}):(0,h.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"}):null]}),(0,h.jsx)(r.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,h.jsx)(r.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:T===e,onPress:()=>$(e),testID:`chef-forecast-range-${e}`},e))}),(0,h.jsx)(c.DaysLineGraph,{days:R,titleSpoken:`${C?'Forecast':'Booked'} covers for the next ${T} days`})]}),(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:"Covers per day"}),(0,h.jsxs)(t.default,{testID:"chef-forecast-days",children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',paddingVertical:6,borderBottomWidth:1,borderColor:n.colours.hairline},children:[(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{flex:1,textAlign:'left'},children:"Day"}),(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:72,textAlign:'right'},children:"Booked"}),C?(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:84,textAlign:'right'},children:"Forecast"}):null]}),z.map((e,o)=>{const s=0===o;return(0,h.jsxs)(t.default,{testID:`chef-forecast-day-${(0,d.ymd)(e.d)}`,accessible:!0,accessibilityLabel:e.f.open?`${(0,d.dayLong)(e.d)}: ${e.booked} booked${C?`, about ${e.covers} forecast`:''}`:`${(0,d.dayLong)(e.d)}: closed`,style:{flexDirection:'row',alignItems:'center',minHeight:40,borderBottomWidth:o({minHeight:48,borderRadius:12,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:e?n.colours.goldTint:'transparent'}),children:(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,children:"Open prep list \u203a"})})]})]})};var o=_r(_d[0]),s=e(_r(_d[1])),t=e(_r(_d[2])),r=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),d=_r(_d[6]),n=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11])},1162,[35,403,103,795,875,1155,859,822,1163,1159,1158,26]); __d(function(g,_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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1163,[829,35,284,365,237,103,427,798,795,828,822,1164,26]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,l=u,f=Math.max(10,i-s-l),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let M=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(p=n.busiest.t,s+(p-n.t0)/x*f-o/2);M={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var p;return{hours:b,busiest:M}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xf+(t-c)/M*b,w=l.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:p(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',f=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=l.indexOf(n);return t+(o<0?1e3:f[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.peakOccupancyText=function(t,n){const o=String(new Date(t).getHours()).padStart(2,'0');return`Peak ${n} ${1===n?'cover':'covers'} at ${o}:00`},e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,f=u,l=Math.max(10,i-s-f),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let p=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(M=n.busiest.t,s+(M-n.t0)/x*l-o/2);p={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var M;return{hours:b,busiest:p}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xl+(t-c)/p*b,w=f.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:M(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',l=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=f.indexOf(n);return t+(o<0?1e3:l[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); __d(function(g,_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.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,I.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,I.useForecast)(),f=(0,k.ymd)(i),p=(0,R.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),m=p.reduce((e,t)=>e+t.sold,0)||1,x=p.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/m)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),b={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{b[e.ing]=(b[e.ing]??0)+e.qty*t.qty}));const y=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini-fish-goujons','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,$.fmtQty)(Math.ceil(2*(b.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,$.fmtQty)(Math.ceil(10*(b.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,$.fmtQty)(Math.ceil(10*(b.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,$.fmtQty)(Math.ceil(2*(b.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,D.useKitchen)(e=>e.tickPrep),w=[...y.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=w.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,q.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,q.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} Covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,q.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} Covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," Covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,q.jsx)(u.Badge,{kind:S===w.length?'ok':'gold',label:`${S}/${w.length} done`})]}),w.map((t,i)=>{const n=e.prepTicks[t.key];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?C.colours.ok:C.colours.border,backgroundColor:C.colours.surface,marginTop:i===y.length?8:0},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:C.colours.muted}:void 0,children:t.text}),n?(0,q.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,q.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,I.useChef)(),a=(0,I.useWeek)(),d=(0,D.useKitchen)(e=>e.addWaste),[f,p]=(0,o.useState)(e.ingredients[0]?.id),[m,x]=(0,o.useState)(''),[b,y]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),k=Number(m.replace(',','.'))||0,S=k>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*k)),T=w&&S?(0,s.inputQuantity)(l,w,k):0,v=e.waste.filter(e=>(0,I.within7)(e.at,r));return w?(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,q.jsx)(I.Tile,{label:"Waste this week",value:(0,j.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,q.jsx)(I.Tile,{label:"Waste as % of food sales",value:a.sales?(0,I.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,q.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,q.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,q.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>p(e.id)},e.id))})}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:m,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:C.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),(0,q.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,q.jsx)(u.T,{weight:"semibold",colour:C.colours.gold,children:(0,j.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,q.jsxs)(u.Row,{children:[(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(k)-.5)))}),(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(k)+.5))}),(0,q.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:D.WASTE_REASONS.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===b,onPress:()=>y(e)},e))}),(0,q.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:b,cost:Math.round(T*w.cost)}),x('')}}),(0,q.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,q.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,q.jsx)(u.T,{size:14,children:(0,j.gbp)(e.cost)})]},e.id))]}):(0,q.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,I.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,b.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'},c=(0,m.useUnsignedDishes)(i),[x,j]=(0,o.useState)(!1);return x?(0,q.jsx)(m.UnsignedDishList,{rid:i,actor:a,onClose:()=>j(!1),onOpenCards:e}):(0,q.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,q.jsx)(d.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>j(!0),style:({pressed:e})=>({minHeight:48,opacity:e?.85:1}),children:(0,q.jsxs)(u.Card,{style:{alignItems:'center'},highlight:c.length?C.colours.amber:void 0,children:[(0,q.jsx)(u.Muted,{center:!0,children:"Dishes not signed off"}),(0,q.jsx)(u.T,{center:!0,size:20,weight:"bold",children:c.length})]})}),(0,q.jsx)(u.Muted,{children:"The 14 allergens from each recipe card. These are what guests see on the menu, takeaway and the booking allergy check. A red warning means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,q.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,l.map(({card:e,fromCosting:t})=>(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",center:!0,children:e.dish}),(0,q.jsx)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i,r='contains'===i?'Contains':'may'===i?'May contain':n?'In costing recipe, not on card':'Not listed';return(0,q.jsxs)(h.default,{accessible:!0,accessibilityLabel:`${e.dish}, ${s.label}: ${r}`,style:{flexGrow:1,flexBasis:220,minWidth:180,maxWidth:'100%',padding:8,borderRadius:8,backgroundColor:n?C.colours.redBg:C.colours.surface2},children:[(0,q.jsx)(u.T,{center:!0,size:14,weight:"semibold",children:s.label}),(0,q.jsx)(u.T,{center:!0,size:14,colour:n?C.colours.red:'contains'===i?C.colours.gold:C.colours.muted,children:r})]},s.id)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Not listed means the allergen is not recorded on this recipe card. Check any costing warnings before sign-off."}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,q.jsxs)(u.Card,{highlight:s.length?C.colours.red:C.colours.amber,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,q.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,q.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,q.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,p.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,q.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,q.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,I.useChef)(),l=(0,k.ymd)(i),a=(0,D.useKitchen)(e=>e.addTemp),c=(0,x.useOwner)(e=>e.checks),{tick:f,untick:p}=x.useOwner.getState(),[m,b]=(0,o.useState)('fridge'),y=E.find(e=>e.id===m),j={...y,units:y.units.filter(e=>(0,n.chefCanSee)(r,e))},[w,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,M=e.temps.filter(e=>e.at.slice(0,10)===l),B=(e,t,i)=>{const n=c[e];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?p(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,children:t}),(0,q.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:E.map(e=>(0,q.jsx)(u.Chip,{label:e.label,selected:e.id===m,onPress:()=>{b(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===w,onPress:()=>S(e)},e))}),(0,q.jsx)(u.Muted,{children:j.rule}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:C.colours.muted,style:{width:90,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),null===$?null:(0,q.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,q.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:m,unit:w,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,q.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",M.length,")"]}),M.length?M.map(e=>{const t=E.find(t=>t.id===e.kind)?.ok(e.temp);return(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,q.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,q.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?C.colours.ok:'warn'===t?C.colours.amber:C.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,q.jsx)(u.Muted,{children:"None yet today."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,q.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),G.map(e=>B(`${l}:kc-${e.id}`,e.text))]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),F.map(e=>B('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,I.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,v.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??I.CHEF_ID,role:'staff'}),[d?.id]),u=(0,T.useChatOpen)(e=>e.ch);return(0,o.useEffect)(()=>{u&&a('chat')},[u]),(0,q.jsx)(S.ChatAsCtx.Provider,{value:c,children:(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(H,{sub:r,setSub:a}),'live'===r?(0,q.jsx)(_,{}):'soldout'===r?(0,q.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,q.jsx)(V,{}):(0,q.jsx)(U,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),D=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),z=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]),N=_r(_d[36]),W=_r(_d[37]),q=_r(_d[38]);const E=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],F=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],G=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function H({sub:e,setSub:t}){const{total:s}=(0,S.useChatUnread)();return(0,q.jsx)(I.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function U(){return(0,q.jsx)(S.Chat,{go:()=>{}})}function _(){const{rid:e,r:t,me:s,now:i}=(0,I.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))),c=(e,t)=>!!(0,B.statusBlock)(e,t,(0,B.linkedBooking)(e,n)),p=(0,b.ticketView)('chef',d),m=(0,f.useStore)(e=>e.setOrderStatus),x=(0,f.useStore)(e=>e.ackReadiness),j=d.flatMap(e=>(0,w.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,q.jsxs)(h.default,{style:{gap:8},children:[j.length?(0,q.jsx)(u.Banner,{kind:"warn",title:`${j.length} readiness alert${j.length>1?'s':''}`,children:j.map(e=>e.detail).join(' \xb7 ')}):(0,q.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,q.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,p.length?p.map(e=>(0,q.jsxs)(u.Card,{highlight:e.allergies.length&&(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))&&'ready'!==e.status?C.colours.red:void 0,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`Table ${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,q.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,q.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,q.jsxs)(u.T,{size:13,colour:C.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,q.jsx)(M.AllergyChain,{o:e,me:s}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{m(e.id,'preparing',s),'takeaway'===e.type&&x(e.id,'cook',s)}}):null,'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>m(e.id,'ready',s)}):null]})]},e.id)):(0,q.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const K=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,k.ymd)(new Date(s,i-1,n+t))};function V(){const{now:e,today:t}={...(0,I.useChef)(6e4),today:(0,k.ymd)(new Date)},{staff:s,shifts:i}=(0,b.rotaView)('chef',(0,x.useOwner)(e=>e.staff),(0,x.useOwner)(e=>e.shifts)),n=(0,x.useOwner)(e=>e.leave),r=(0,N.canEditKitchenRota)((0,P.useSync)(e=>e.perms)),l=(0,x.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),a=(0,v.weekday)(e),o=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),d=(0,z.useSession)(e=>e.meId),c=(0,P.useSync)(e=>e.staffRef),f=d??c??I.CHEF_ID,p=(0,x.useOwner)(e=>e.staff.find(e=>e.id===f)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(L.BreakRoomCard,{staffId:f,name:p,now:e}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"On now"}),l.length?l.map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,q.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,q.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",v.DAY3[a],")"]}),i.filter(e=>e.date===t).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,W.leaveCovering)(n,e.staffId,e.date)?(0,q.jsx)(u.T,{size:13,colour:C.colours.blue,children:(0,W.leaveLabel)((0,W.leaveCovering)(n,e.staffId,e.date))}):(0,q.jsxs)(u.Muted,{children:[(0,v.fmtH)(e.start),"\u2013",(0,v.fmtH)(e.end)]})]},e.id))]}),r?(0,q.jsx)(u.Card,{children:(0,q.jsx)(A.KitchenRotaEditor,{today:t})}):(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),o.map(e=>(0,q.jsxs)(h.default,{style:{gap:4},children:[(0,q.jsx)(u.T,{size:14,children:e.name}),(0,q.jsx)(u.Row,{wrap:!0,gap:4,children:v.DAY3.map((s,n)=>{const r=i.find(s=>s.staffId===e.id&&s.date===K(t,n-a));return(0,q.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:r?C.colours.goldTint:C.colours.surface2,alignItems:'center'},children:[(0,q.jsx)(u.T,{size:10,colour:C.colours.muted,children:s}),(0,q.jsx)(u.T,{size:10,children:r?`${(0,v.fmtH)(r.start).slice(0,2)}\u2013${(0,v.fmtH)(r.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})]})}},1165,[828,955,1166,836,861,1167,1168,35,403,296,103,795,875,883,1169,892,966,862,868,1172,859,822,1173,1099,1073,1154,1153,1174,870,1158,1011,896,1175,977,958,1178,961,1087,26]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1166,[1153,955]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1167,[828,35,103,795,875,950,892,951,952,953,832,822,26]); @@ -1261,7 +1261,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";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=w,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,l.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,y.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,y.jsx)(w,{today:e}):(0,y.jsx)(I,{today:e})})},_e.KitchenRotaRead=I;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],j=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,k=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,p=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function w({today:e=(0,h.ymd)(new Date)}){const r=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,l.kitchenTeam)(r),[r]),$=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[w,I]=(0,t.useState)(0),S=(0,f.useDateCalendar)(),[v,C]=(0,t.useState)(null),[T,H]=(0,t.useState)(''),P=(0,a.addDays)((0,a.mondayOfDate)(e),7*w),L=(0,a.addDays)(P,6),R=b.map((e,t)=>(0,a.addDays)(P,t)),M=(0,l.kitchenPending)(o,$,P,L).length,O=e=>{H(e),(0,u.announce)(e)},W=0===w?'This week':1===w?'Next week':-1===w?'Last week':`Week of ${k(P)}`;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center',flexWrap:'nowrap'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(w-1),H('')},style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${W}, ${x[0]} ${k(P)} to ${x[6]} ${k(L)}`,style:{alignItems:'center',minWidth:120,flex:1},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:W}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(P)," \u2013 ",j(L)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(w+1),H('')},style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:S.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:S.calOpen,today:e,day:P,showBusy:!0,idPrefix:"krota-cal",onClose:S.closeCal,onDay:t=>{I((0,f.weekOffsetOf)(t??e,e)),H('')}}),d.map(t=>(0,y.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[p(t.nickname||t.name),t.job?(0,y.jsx)(n.T,{size:12,colour:m.colours.muted,children:` ${t.job}`}):null]}),(0,y.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:R.map((i,a)=>{const l=o.find(e=>e.staffId===t.id&&e.date===i),r=!(!l||l.published&&!l.changed),d=`${p(t.nickname||t.name)}, ${x[a]} ${k(i)}, ${l?`${(0,c.fmtH)(l.start)} to ${(0,c.fmtH)(l.end)}${r?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,y.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>C({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:r?'dashed':'solid',borderColor:l?r?m.colours.amber:m.colours.gold:m.colours.border,backgroundColor:e||l?m.colours.goldTint:m.colours.surface2}),children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:i===e?m.colours.gold:m.colours.muted,children:b[a]}),(0,y.jsx)(n.T,{size:10,center:!0,children:l?`${(0,c.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(l.end).slice(0,5)}):(0,y.jsx)(n.T,{size:10,center:!0,colour:m.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,y.jsx)(n.Button,{testID:"krota-publish",kind:M?'primary':'secondary',disabled:!M,label:M?`Publish kitchen rota (${M} ${1===M?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:M?`Publish the kitchen rota for ${W.toLowerCase()}, ${M} ${1===M?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,$,P,L);a.useOwner.getState().setShifts(e.shifts),O(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,y.jsx)(i.default,{testID:"krota-msg",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.goldLight,children:T})}):null,(0,y.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),v?(0,y.jsx)(D,{init:v,onClose:()=>C(null),onSaid:O}):null]})}function I({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:l}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,$]=(0,t.useState)(0),w=(0,f.useDateCalendar)(),I=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),D=(0,a.addDays)(I,6),S=b.map((e,t)=>(0,a.addDays)(I,t)),v=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),C=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${k(I)}`,[T,H]=(0,t.useState)(0),P=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>H(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>$(u-1),style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${C}, ${x[0]} ${k(I)} to ${x[6]} ${k(D)}`,style:{alignItems:'center',minWidth:120},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:C}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(I)," \u2013 ",j(D)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>$(u+1),style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:w.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:w.calOpen,today:e,day:I,showBusy:!0,idPrefix:"krota-read-cal",onClose:w.closeCal,onDay:t=>$((0,f.weekOffsetOf)(t??e,e))}),v.map(t=>(0,y.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:p(t.nickname||t.name)}),(0,y.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=l.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,r.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,r.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,y.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${p(t.nickname||t.name)}, ${x[a]} ${k(s)}, ${u}`,style:{width:P,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.goldTint:m.colours.surface2},children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:s===e?m.colours.gold:m.colours.muted,children:b[a]}),o&&h?(0,y.jsx)(n.T,{size:9,center:!0,colour:m.colours.blue,children:(0,r.leaveLabel)(h).toLowerCase()}):(0,y.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),v.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,y.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function D({init:e,onClose:s,onSaid:r}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=p(o?.nickname||o?.name||''),[u,f]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[j,w]=(0,t.useState)(!1),[I,D]=(0,t.useState)(''),S=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${k(e.date)})`;return(0,y.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${S}`,testID:"krota-sheet",children:(0,y.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,y.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{f(t),x(s)}},e))}),(0,y.jsx)(n.T,{center:!0,children:"Start"}),(0,y.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:f,format:c.fmtH,label:"Start time"}),(0,y.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,y.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,y.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),I?(0,y.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.amber,children:I})}):null,(0,y.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?D(`${d} already has a shift that overlaps on ${S}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),r(`${e.shift?'Changed':'Added'}: ${d}, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!j?(0,y.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&j?(0,y.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",S,"?"]}),(0,y.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),r(`Removed ${d}'s shift on ${S}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,y.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1178,[35,403,103,795,892,961,1087,966,958,1076,859,1111,1067,822,26]); __d(function(g,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.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1179,[1166,955,35,380,103,795,892,966,868,822,1073,1158,1011,1180,26]); __d(function(g,_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.openLink=w,_e.useSheetReminders=C,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=C(),f=(0,b.wd)(l);return(0,j.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,j.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,j.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,j.jsx)($,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,j.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]);function w(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function k(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const S={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},T={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function C(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function $({s:e,open:n,onToggle:o}){const{rid:C,r:$,me:D,now:I}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),M=(0,u.useOrderSheets)(e=>e.markOpened),B=(0,u.useOrderSheets)(t=>t.opened[e.id]),[L,P]=(0,s.useState)({}),[O,R]=(0,s.useState)(''),[A,z]=(0,s.useState)(''),[_,W]=(0,s.useState)(!1),H=(0,h.useShellfish)(C,D,'chef'),K=(0,b.nextDelivery)(e,I),E=(0,b.orderLines)(e,L,O,C),N=($.address??$.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=N.length>=3?N[1]:N[0]??'',U=(0,b.orderMessage)(e,$.name,q,E,D.split(' ')[0],I),Q=e.orderDays.includes((0,b.wd)(I)),Y=(e,t)=>P(n=>({...n,[e.id]:(0,l.stepQuantity)(C,e,n[e.id]||0,t)})),F=t=>{M(e.id,I.toISOString()),w(t)},G='text'===e.method||'whatsapp'===e.method||'phone'===e.method,V=Math.round(100*((0,y.parseMoneyInput)(A)??NaN)),J=H.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),X=J.filter(e=>H.isLow(e.key));return(0,j.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:Q||X.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,j.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[S[e.method]," ",e.name]}),(0,j.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,j.jsx)(i.Muted,{children:e.goods}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,j.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,j.jsx)(i.Badge,{kind:Q?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,j.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,j.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,J.length?(0,j.jsx)(i.Badge,{kind:X.length?'amber':'ok',label:J.map(e=>`${e.icon} ${(0,c.fmtStockCount)(C,e,H.counts[e.key]??0)}`).join(' \xb7 ')}):null,B&&new Date(B).toDateString()===I.toDateString()?(0,j.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,j.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[K?(0,j.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(K),"."]}):null,e.reminder?(0,j.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,j.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,j.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,j.jsxs)(d.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{children:[e.name,e.unit?(0,j.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(C,e),")"]}):null]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Y(e,-1),style:{minWidth:44,minHeight:44}}),(0,j.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(C,e,L[e.id]||0),children:(0,j.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(C,e)?(0,l.fishQtyText)(C,e,L[e.id]||0):L[e.id]||0})}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Y(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,j.jsx)(t.TextInput,{value:O,onChangeText:R,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[T,{minHeight:60}]})]}),G?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(C,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,'online'===e.method?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(C,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,e.priceCapPerKg?(0,j.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,j.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,j.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,j.jsx)(t.TextInput,{testID:"price-found",value:A,onChangeText:e=>z((0,y.sanitiseMoneyTyping)(e)),keyboardType:"decimal-pad",inputMode:"decimal",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[T,{width:120}]})]}),V>0?(0,j.jsx)(i.Badge,{kind:V<=e.priceCapPerKg?'ok':'red',label:V<=e.priceCapPerKg?`${(0,p.gbp)(V)}/kg is under the cap \u2713`:`${(0,p.gbp)(V)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,j.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,j.jsx)(i.T,{size:f.font.small,children:E.length?U:'Add quantities above to write the order.'})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!E.length,onPress:()=>F((0,b.smsLink)(e.number,U))}):null,'whatsapp'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!E.length,onPress:()=>F((0,b.waLink)(e.number,U))}):null,'phone'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>F((0,b.telLink)(e.number))}):null,'online'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>F(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&E.length?(0,j.jsx)(i.Button,{kind:"ghost",label:_?'Copied \u2713':'Copy order',onPress:async()=>{const e=await k(U);W(e),e&&setTimeout(()=>W(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,j.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,j.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1180,[828,836,955,35,380,237,403,103,795,1009,954,956,868,1010,822,1158,14,26]); -__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); +__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',justifyContent:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},1182,[5,823,824,829,237,827]); __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,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',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,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',w:64,h:45}}},1183,[]); __d(function(g,_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(', '))})]})}},1184,[828,1009,1166,955,35,403,103,795,892,868,822,1158,1011,14,26]); @@ -1301,7 +1301,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.AssignRoleSheet=function({name:e,when:s,current:u,onSave:b,onEditTimes:y,onClose:j}){const x={minHeight:o.IS_CAR?64:56,width:'100%'},_=(0,l.cleanBadge)(u);return(0,c.jsxs)(n.Sheet,{visible:!0,onClose:j,title:"Assign a role?",testID:"assign-role-sheet",maxWidth:560,children:[(0,c.jsx)(n.T,{size:18,center:!0,weight:"semibold",children:e}),(0,c.jsx)(n.Muted,{center:!0,children:s}),(0,c.jsxs)(t.default,{style:{gap:8,width:'100%'},children:[l.ROLE_BADGES.map(e=>(0,c.jsx)(n.Button,{kind:_===e?'primary':'secondary',label:e,testID:`assign-role-${h(e)}`,accessibilityLabel:`${e}${_===e?', chosen':''}`,onPress:()=>b(e),style:x},e)),(0,c.jsx)(n.Button,{kind:_?'secondary':'primary',label:"None",testID:"assign-role-none",accessibilityLabel:_?'None, clear the role badge':'None, chosen',onPress:()=>b(void 0),style:x}),y?(0,c.jsx)(n.Button,{kind:"ghost",label:"Edit shift times",testID:"assign-role-edit-times",onPress:y,style:x}):null]})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),o=r(d[4]),c=r(d[5]);const h=e=>e.replace(/\s+/g,'-').toLowerCase()},1218,[35,103,795,1217,873,26]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1219,[35,103,795,892,822,1073,1076,1215,1087,26]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1220,[35,103,1073,822,795,26]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),f=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),u=(0,n.useOwner)(e=>e.staff),x=(0,o.workingNow)(f,u,t),w=(0,o.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:r.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:r.colours.muted,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:r.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:r.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:r.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:r.colours.muted,center:!0,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:r.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:r.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),h=_r(d[7])},1221,[35,103,1073,892,1222,822,795,26]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:t=!1,marquee:s=!1}={}){const{today:u}=(0,o.useCtx)(15e3),p=(0,l.useOwner)(e=>(0,l.liveAttendance)(e.attendance)),j=(0,l.useOwner)(e=>e.staff),I=(0,r.workingNow)(p,j,u),D=(0,r.cardSpeech)(I),[k,v]=(0,e.useState)(0),[L,S]=(0,e.useState)(0),[W,O]=(0,e.useState)(y);if((0,e.useEffect)(()=>{t&&s&&x()},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'function'!=typeof window.matchMedia)return;const e=window.matchMedia('(prefers-reduced-motion: reduce)'),n=()=>O(!!e.matches);return n(),e.addEventListener?e.addEventListener('change',n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener('change',n):e.removeListener(n)}},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'undefined'==typeof ResizeObserver)return;const e=document.querySelector('[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]');if(!e)return;const n=()=>{const t=e.querySelector('[data-testid="whos-on-shift-list"]');v(e.clientWidth),t&&S(Math.max(t.scrollWidth,t.offsetWidth))},o=new ResizeObserver(n);o.observe(e);const l=e.querySelector('[data-testid="whos-on-shift-list"]');return l&&o.observe(l),n(),()=>o.disconnect()},[t,s,I.length,D]),t&&s){const e=k>0&&L>k+1&&f&&!W,t=w.find(e=>e>=Math.round((L+48)/32))??80,s=0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,numberOfLines:1,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",children:(0,h.jsx)(b,{rows:I,testIds:!0})});return(0,h.jsxs)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:0,paddingHorizontal:10,height:44,maxHeight:44,minHeight:44,overflow:'hidden',width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',gap:8},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",numberOfLines:1,style:{flexShrink:0},children:r.CARD_TITLE}),(0,h.jsxs)(n.default,{testID:"whos-on-shift-marquee",onLayout:e=>v(e.nativeEvent.layout.width),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,height:44,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:[(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",onLayout:e=>S(e.nativeEvent.layout.width),style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row',flexWrap:'nowrap',flexShrink:0,width:'max-content'},children:(0,h.jsx)(b,{rows:I,testIds:!1})}),e?(0,h.jsxs)(n.default,{dataSet:{ccwho:`tick-${t}`},style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center'},children:[(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:s}),(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:(0,h.jsx)(b,{rows:I,testIds:!1})})]}):(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,width:'max-content'},children:s})]})]})}if(t)return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:d.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:18,colour:d.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:d.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:d.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]);const f='undefined'!=typeof document,w=[18,24,32,40,50,64,80],u=`\n[data-testid="display-whos-on-top"]{overflow:hidden;max-width:100%;width:100%}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"] *{flex-wrap:nowrap!important;white-space:nowrap}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"]{display:inline-flex!important;flex-direction:row;align-items:center;width:max-content!important;max-width:none!important}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]>[data-ccwho],[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;width:max-content}\n${w.map(e=>`[data-testid="display-whos-on-top"] [data-ccwho="tick-${e}"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;animation:ccwho-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccwho-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{animation:none!important}}\n`;let p=!1;function x(){if(!f||p)return;p=!0;const e=document.createElement('style');e.setAttribute('data-ccwho-css','1'),e.textContent=u,document.head.appendChild(e)}const y=()=>f&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;function b({rows:e,testIds:t}){return(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',columnGap:10,flexShrink:0,width:'max-content'},children:e.map(e=>(0,h.jsxs)(n.default,{testID:t?`whos-on-shift-${e.staffId}`:void 0,accessible:t,accessibilityLabel:t?e.speech:void 0,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,numberOfLines:1,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,numberOfLines:1,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})}},1221,[35,237,103,1073,892,1222,822,795,26]); __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1222,[]); __d(function(g,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.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1223,[828,1042,35,403,103,795,1012,822,901,26]); __d(function(g,_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.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1224,[828,797,1225,1143,836,892,35,337,403,103,795,1012,1013,822,896,901,1226,1229,1231,26]); @@ -1426,7 +1426,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}},1343,[828,861,35,103,795,862,868,1168,1344,875,822,26]); __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})},1344,[904,958,1168]); __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]})}},1345,[31,35,873,1346,1416,26]); -__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=e(_r(_d[40])),G=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]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ye.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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:l?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:l?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),s?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.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||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ye.jsx)(Q.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${s.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ye.jsx)(Q.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ye.jsx)(Q.T,{size:12,colour:se.colours.muted,children:l}):null]})}function at({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,s));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:l?16:18,weight:"bold",children:[it(e)," \xb7 ",lt(e.customerName)]}),(0,Ye.jsx)(Q.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,Ye.jsxs)(Q.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,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,le.useRestaurant)(jt);(0,Re.useAlertWatcher)(jt,{enabled:!e});const kt=(0,le.useOrders)(jt),It=(0,le.useBookings)(jt),Dt=(0,le.useEvents)(jt),vt=(0,le.useStore)(e=>e.skipMinutes),St=(0,le.useStore)(e=>e.clock.mode),Ct=(0,le.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Rt=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,Ne.workingShifts)(Rt,Bt),[Rt,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Wt=(0,$.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:lt(Tt.find(e=>e.id===Wt)?.name)}),Ht=I.IS_CAR?'Car':'Display';(0,L.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,ne.useFrontDoor)(Pt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Ft=(0,re.useFloor)(e=>e.live[jt]),Gt=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,el]=(0,H.useState)(null),[tl,ll]=(0,H.useState)(null),[sl,il]=(0,H.useState)(!1),[ol,nl]=(0,H.useState)(!1),[al,rl]=(0,H.useState)(null),[dl,cl]=(0,H.useState)(!1),[ul,hl]=(0,H.useState)(!1),[gl,bl]=(0,H.useState)(!1),[yl,pl]=(0,H.useState)(null),[fl,xl]=(0,H.useState)(null),[ml,jl]=(0,H.useState)(null),[wl,kl]=(0,H.useState)(!1),Il=P.default.useRef(0),Dl=e=>{Il.current=Date.now(),jl(e)};P.default.useEffect(()=>{if(!ml)return;const e=setInterval(()=>{Date.now()-Il.current>=He.DAY_IDLE_MS&&jl(null)},5e3);return()=>clearInterval(e)},[ml]);const vl=(0,le.useWaitlist)(jt),Sl=(0,le.useStore)(e=>e.walkIns[jt]??0),[Cl,Tl]=(0,H.useState)(!1),[$l,Rl]=(0,H.useState)(!1),[Bl,Ll]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Wl,zl]=(0,H.useState)({view:0,content:0}),[Hl,Pl]=(0,H.useState)(null);P.default.useEffect(()=>{Hl&&((0,W.notify)({id:`floor-note:${Date.now()}`,title:Hl,timeoutMs:4500,big:!0,testID:'floor-toast'}),Pl(null))},[Hl]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Ml,Al]=(0,H.useState)(null),El=P.default.useRef(0),[Ol,Nl]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ml)return;El.current=Date.now();const e=setInterval(()=>{const e=Date.now()-El.current;if(e>=Xe)return Al(null),void Pl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nl(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ml]);const _l=e=>e.date!==Pt?ll({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!ci.ok,accessibilityHint:ci.hint,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ll({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ll(null),Pl(e)}}):null,e.walkIn?(0,Ye.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ll(null),Pl(e)}}):null,(0,Se.bookingDetails)(e)]})}),Fl=It.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),Gl=Fl.filter(e=>!['cancelled','noshow'].includes(e.status)),Vl=kt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ul=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),Kl=(0,Be.closedAreasAt)(Gt,jt,Pt,(0,te.hm)(Ct)),ql=[...Kl].join(','),Yl=(0,H.useMemo)(()=>(0,de.floorView)(_t,It,kt,Ft??{},Ct,wt.settings.turnMins,Kl),[_t,It,kt,Ft,Ct.getTime(),ql]),Ql=(0,ve.hoursFor)(wt,Ct),Jl=Ql?.open??new Date(`${Pt}T12:00:00`),Xl=Ql?.close??new Date(`${Pt}T21:00:00`),Zl=(0,te.addMins)(Jl,-Jl.getMinutes()),es=(0,te.addMins)(Xl,30),ts=e=>new Date(`${Pt}T${e}:00`),ls=(0,Be.blocksOn)(Gt,jt,Pt).map(e=>({from:ts(e.from),to:ts(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Pt)),ss=Object.keys(Yl).filter(e=>'blocked'===Yl[e]?.status),is=ml&&ml!==Pt?ml:Pt,os=is!==Pt,ns=(0,He.dayWord)(is,Pt),as=/^(Today|Yesterday|Tomorrow)$/.test(ns),rs=os?(0,He.bookingsForDay)(It,is,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Fl,ds=(0,te.parseYmd)(is);ds.setHours(12);const cs=os?(0,ve.hoursFor)(wt,ds):Ql,us=cs?.open??new Date(`${is}T12:00:00`),hs=cs?.close??new Date(`${is}T21:00:00`),gs=e=>new Date(`${is}T${e}:00`),bs=[...os?(0,Be.blocksOn)(Gt,jt,is).map(e=>({from:gs(e.from),to:gs(e.to),label:e.reason??'Paused'})):ls,...os?(0,o.queuedServicePauses)(wt,ds,is):[]],ys=(0,o.queuedServiceSessions)(wt,ds),ps=s.IS_QUEUED_VENUE&&(void 0===ys||!ys.length),fs=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ys?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),xs=os?cs||rs.length?isos?(0,de.dayFloorView)(_t,rs,is):Yl,[os,_t,rs,is,Yl]),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),[Ss,Cs]=(0,H.useState)(null),Ts=os?rs.filter(e=>!['cancelled','noshow'].includes(e.status)):Gl,$s=Ts.reduce((e,t)=>e+t.partySize,0),Rs=(0,u.coversSplit)(Ts,is),Bs=(0,Me.cancelledDayTally)(It,is),Ls=(0,Ae.cancellationsFor)(It,is,e=>e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Ws=(0,Me.cancelledTallyWords)(Bs,as?ns.toLowerCase():os?`on ${ns}`:'today'),zs=Gt.filter(e=>e.rid===jt&&e.date===is&&!e.removedAt),Hs=(0,ze.chartBands)(zs,60*us.getHours()+us.getMinutes(),60*hs.getHours()+hs.getMinutes()),Ps=new Set((0,ze.blockedHours)(Hs)),Ms=Ct.getHours()+(Ct.getMinutes()>=30?1:0),As=Ul.hours.filter(e=>e.hour>=Ms&&!Ps.has(e.hour)),Es=As.reduce((e,t)=>e+t.coversHigh,0),Os=As.reduce((e,t)=>e+t.coversLow,0),Ns=Math.round((Os+Es)/2),_s=!Ul.example&&Ul.open&&Ul.enough&&Es>0?`Usually ${(0,c.coversRange)(Ns,Ns)} more`:void 0,Fs=async(e,t)=>{const l=Yl[e]?.booking;if(!l||e===t)return;const s=Yl[t]?.status;if(s&&!['free','soon'].includes(s))return void Pl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Pl,{b:l,tables:[t]}))return;await le.repo.bookings.update(l.id,{table:t});const i=Ft?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Pl(`Saving: ${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(l.id,`${(0,xe.privName)(l,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}`,Pl)},Gs=e=>{if(fl)return Is(null),void xl(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);os?ws(e):Zt?(e!==Zt&&Fs(Zt,e),el(null)):Xt(e)},Vs=fl?It.find(e=>e.id===fl.id):void 0,Us=fl&&Vs?(()=>{const e=Vs.walkIn?(0,xe.privName)(Vs,Ot):lt(Vs.name),t=(0,De.seatsOf)(_t,fl.tables).total,l=(0,De.seatLine)(t,Vs.partySize),s=(0,De.pickClashes)(Vs,fl.tables,It.filter(e=>e.date===Vs.date),wt.settings.turnMins),i=(0,De.tableKey)(fl.tables)!==(0,De.tableKey)((0,re.tablesOf)(Vs.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(Vs.date,Pt)} ${Vs.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(fl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(Vs.date,Pt)," ",Vs.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:se.colours.text,children:[(0,De.tablesWords)(fl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ks?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ks,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ks})}):null,Ds&&Vs&&fl.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,fl.tables.join('+')),onYes:()=>{vs(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,l,e,t,Pl)})()},onNo:()=>vs(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:ks?'plan-pick-overcap-yes':'plan-pick-save',label:ks?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ks?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(fl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Vs)return void xl(null);if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=(0,De.overCapacityAsk)(fl.tables,t,Vs.partySize);if(l&&!ks)return void Is(l);if('finished'===Vs.status&&fl.tables.length&&!Ds)return void vs(!0);Is(null),vs(!1);const s=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,s,e,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Is(null),xl(null)}})]})]})})():null,Ks=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),qs=e=>{const t=_t.tables.filter(t=>t.areaId===e);return os?`${t.filter(e=>!ms[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Yl[e.name]?.status??'free')).length}/${t.length} free`},Ys='all'===Yt||Ks.some(e=>e.id===Yt)?Yt:'all',Qs=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:ms,privacy:Ot,turnBase:wt.settings.turnMins,highlight:fl?fl.tables:Zt?[Zt]:void 0,onTap:e=>Gs(e.name),onDrop:(e,t)=>fl||os?void 0:Fs(e.name,t.name)}),Js=ut?1:ht||Ks.length>2?2:1,Xs=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=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)/l},Zs=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ti=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:qs(e.id)})]}),li=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(l-xt.h)>1)&&mt({w:t,h:l})},children:ei?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:ei.scroll,showsVerticalScrollIndicator:ei.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:ei.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:ei.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=Ks.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ei.cellW,gap:2},children:[ti(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:Qs(e)})]},e)})},t))}):null}),si=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Ys,onPress:()=>Qt('all')},"__all"),...Ks.map(e=>(0,Ye.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ut?Kl.has(e.id)?'closed':Ys===e.id?qs(e.id):void 0:void 0,selected:Ys===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;zl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>zl(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:Wl.view>0&&Wl.content>0&&Wl.content<=Wl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Wl.view>0&&Wl.content<=Wl.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),Us,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>el(null)})]}):null,'all'===Ys&>?li:'all'===Ys?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:Zs.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>Xs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:qs(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:qs(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*Xs(e.id)))}:{flex:1},children:Qs(e.id)})]},e.id)),e.length{if(os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},is)}),oi='timeline'===Vt,ni=Kt?(0,Ye.jsx)(F.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${os?(0,He.dayLong)(is):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),ps?fs:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:os?rs:Fl,now:os?us:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:os?(0,te.addMins)(us,-us.getMinutes()):Zl,t1:os?(0,te.addMins)(hs,30):es,pauses:os?bs:ls,blockedTables:os?[]:ss,onOpen:e=>{if(qt(!1),os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},`full-${is}`)})]})}):null,ai=os?(0,Ye.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:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:as?`Showing ${ns} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(is))}`:`Showing ${(0,He.dayWord)(is,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ws}. Showing ${(0,He.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{xl(null),Dl(null)},style:{minHeight:44}})]}):null,ri=(0,Ye.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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(oi||Kt);return(0,Ye.jsx)(V.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.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,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),di='display'===I.APP_VARIANT&&!e?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ri,(0,Ye.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:Rt,staff:Tt,today:Pt,leave:Bt})]}):ri,ci=(0,h.useBookingWrite)(),ui=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>nl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint})]});(0,qe.useDisplayNotices)(jt,!e);const hi=ut?180:168,[gi,bi]=(0,H.useState)(hi),yi=P.default.useRef(hi),pi=P.default.useRef(null),fi=P.default.useRef(null),xi=()=>{const e=pi.current,t=fi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=ct<820?8:12,o=44+(ct<820?4:8),n=i>yi.current?Math.ceil(i-yi.current):We.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(hi,Math.floor(t-s-l)-n-o));Math.abs(yi.current-a)>=2&&(yi.current=a,bi(a))})})};P.default.useEffect(()=>{const e=setTimeout(xi,60);return()=>clearTimeout(e)},[rt,ct]);const mi=(0,Ye.jsxs)(K.default,{ref:fi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),xi()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Nl(null),Al({at:Date.now()})},onHint:()=>Pl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(Le.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:is}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(Le.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ll(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),ji=Vl.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:se.colours.muted,children:[Vl.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Vl,me:zt,compact:!0,bookings:It})})]}):null,wi=(Oe.DueToday,wt.settings.turnMins||90),ki=os?rs:(0,v.todaysGuestList)(Fl,Ct,wi),Ii=os?[]:(0,v.todaysFinishedList)(Fl,Ct,wi),Di=os?as?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',vi=(0,Ye.jsxs)(Ye.Fragment,{children:[0===ki.length?(0,Ye.jsx)(Q.Muted,{children:os?is{const t=(0,v.isLeftEarly)(e,Ct,wi),l=(0,ie.isSeatedHighlight)(e.status,{otherDay:os})&&!t,s=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=se.colours.text,o=l?se.colours.goldLight:se.colours.muted,n=se.colours.gold,a=s.depositWarn?se.colours.amber:se.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:os?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(_.AllergyIcon,{text:s.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,s.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ii.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ii.length}${gl?', expanded':', collapsed'}`,accessibilityState:{expanded:gl},onPress:()=>bl(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ii.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:se.colours.muted,children:gl?'\u25be':'\u25b8'})]}),gl?Ii.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:ci.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Ee.CancellationsSection,{items:Ls,dayWord:os?as?ns.toLowerCase():`on ${ns}`:'today'})]}),Si=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:vi}),Ci=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&hl(!1)}}),Ti=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Di}, ${ki.length}`,accessibilityState:{expanded:ul},'aria-expanded':ul,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:ul?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:ul?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:se.colours.gold,children:ki.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Di," ",ul?'\u2039':'\u203a']})})})]}),$i=ul?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...Ci.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Di.toUpperCase()," (",ki.length,")"]}),(0,Ye.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Di}`,onPress:()=>hl(!1),style:{marginRight:-6}})]}),Bs.count?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Ws}):null]}),Si]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Di}`,accessibilityRole:"button",onPress:()=>hl(!1),style:{flex:1}})]}):null,Ri=ps?fs:s.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:rs,open:us,close:hs,now:Ct,turnBase:wt.settings.turnMins,blocks:zs,pauses:bs,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:hi,forecastNote:os?void 0:_s,emptyText:xs,past:is{Il.current=Date.now(),kl(!0)},shortDay:!ut&&rt<1100}),Wi=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:wl,today:Pt,day:is,bookings:It,restaurant:wt,now:Ct,onDay:Dl,onClose:()=>kl(!1)}),zi=()=>{os?hl(!0):qt(!0)},Hi=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ct<820?8:12,paddingTop:ct<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[Mt?null:Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:ai,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):oi?ii:si,ni,$i]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ui(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:di}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:ct<820,snug:ct<820,tight:ct<700,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{ref:pi,testID:"day-graph-slot",onLayout:xi,style:{flexGrow:0,flexShrink:1,flexBasis:hi+52,minHeight:ct<=600?90:120,overflow:'visible'},children:Bi}),(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),ji,(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Il.current=Date.now()},onMouseDown:()=>{Il.current=Date.now()},children:[ut?(0,Ye.jsxs)(K.default,{style:{flex:1},children:[(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt}),Li,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(ot,{phone:!0,split:Rs,items:[{label:`Tables \xb7 ${ns}`,value:Ts.length,testID:'badge-tables'},{label:`Covers \xb7 ${ns}`,value:$s,testID:'badge-covers'},{label:'Takeaway',value:Vl.length,alert:Vl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>il(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ui(!0)}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),di,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[oi?ii:si,ni]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Di," (",ki.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{gap:4},children:vi})]}),ji,Bi,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),mi]}),e?null:(0,Ye.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:se.colours.hairline},children:(0,Ye.jsx)(N.VoiceSlot,{size:56})})]}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ct<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ye.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Li}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,Ye.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.muted,children:"?"})}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,e?null:(0,Ye.jsx)(j.ExitButton,{}),ee,Ue?null:(0,Ye.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,!I.IS_CAR&&Mt?(0,Ye.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(ot,{splitOnly:!0,split:Rs,items:[]})})]})}),gt?Hi:(Pi=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ui(!1)}),di]}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[ai,oi?ii:si,ni,$i]})]})}),ji,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:hi+We.DAY_GRAPH_CHROME},children:Bi})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Pi})),mi]}),(0,Ye.jsx)(R.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ll(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Bl,onClose:()=>Ll(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ol?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>nl(!1)}):null,al?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:al,who:zt,onClose:()=>rl(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Yl,plan:_t,todays:Fl,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>el(e),onDetails:_l}):null,js?(()=>{const e=ms[js],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Cs(null),ws(null)},title:`${(0,d.tableNumbersA11y)(js)} \xb7 ${as?ns:(0,He.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${as?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${as?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Ot):lt(e.name);return(0,Ye.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ws(null),pl(e.id)},style:{minHeight:56}},e.id)}),is>=Pt?(()=>{const t=e?.table.maxSeats??0,l=It.filter(e=>e.date===is&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(js)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(js)]}),Ss?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Ss.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Ss.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ci.ok,accessibilityHint:ci.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Ss.id);if(Cs(null),!e)return;const l=lt(e.name);ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Cs(null)})]})]}):null,Ss?null:l.slice(0,12).map(e=>{const l=lt(e.name),s=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ci.ok,accessibilityHint:ci.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(js)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:e,tables:[js]}))return;const s=(0,De.overCapacityAsk)([js],t,e.partySize);s?Cs({id:e.id,ask:s}):(ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Cs(null),ws(null)},style:{minHeight:56}})]})})():null,yl?(()=>{const e=It.find(e=>e.id===yl);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Ot):lt(e.name),view:Yl,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>pl(null),onDetails:_l,onDone:Pl,onEdit:e=>{pl(null),rl(e.id)},onPickOnPlan:(e,t)=>{hl(!1),Ut('plan'),Qt('all'),xl({id:e.id,tables:t})}}):null})():null,tl?(0,Ye.jsx)(Se.DetailsPanel,{title:tl.title,onClose:()=>ll(null),children:tl.body}):null,Wi,dl?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Fl,orders:kt,waitlistAll:vl,walkInCount:Sl,onClose:()=>cl(!1)}):null,Cl?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Tl(!1)})]}):null,$l?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Rl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Rl(!1)})]}):null,sl?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>il(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Vl,me:zt,bookings:It})]}):null,Ml?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{El.current=Date.now(),null!==Ol&&Nl(null)},notice:null!==Ol?`Locking again in ${Ol} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Al(null),Pl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Pl('Live seating plan updated on every screen.')},onCancel:()=>{Al(null),Pl('No changes kept. Editing is locked again.')}},Ml.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)($e.TakeawayTakeover,{rid:jt,me:zt})]});var Pi}function dt({rid:e,id:t,turnBase:l}){const s=(0,le.useBookings)(e).find(e=>e.id===t);return s?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); +__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,qe.jsx)(rt,{...e}):(0,qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Q.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]),o=_r(_d[4]),n=_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]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_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]),H=_r(_d[32]),z=_r(_d[33]),M=e(z),P=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_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])),Y=e(_r(_d[45])),q=_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]),oe=_r(_d[56]),ne=_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]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_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]),He=_r(_d[85]),ze=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_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]),Ye=_r(_d[99]),qe=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?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)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,qe.jsx)(Q.T,{size:s?14:12,colour:le.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)(M.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||o?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)(Q.T,{size:14,colour:le.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)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Q.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:le.colours.gold},children:[(0,qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){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:n?4:7,minHeight:44,paddingHorizontal:n?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:[o?(0,qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,qe.jsx)(Q.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.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:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,qe.jsx)(Q.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)(Q.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)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,Y.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=M.default.useRef(null),xt=M.default.useRef(0),[ft,mt]=(0,z.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const kt=(0,se.useOrders)(jt),It=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),Rt=(0,oe.useOwner)(e=>e.attendance),$t=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Wt=M.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);M.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Mt=(0,te.ymd)(Ct),Pt=(0,A.useTravelDay)('display',Mt),At=(0,ne.useFrontDoor)(Mt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,xe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,z.useState)('plan'),[Kt,Yt]=(0,z.useState)(!1),[qt,Qt]=(0,z.useState)('all'),[Jt,Xt]=(0,z.useState)(null),[Zt,es]=(0,z.useState)(null),[ts,ss]=(0,z.useState)(null),[ls,is]=(0,z.useState)(!1),[os,ns]=(0,z.useState)(!1),[as,rs]=(0,z.useState)(null),[ds,cs]=(0,z.useState)(!1),[us,hs]=(0,z.useState)(!1),[gs,bs]=(0,z.useState)(!1),[ys,ps]=(0,z.useState)(null),[xs,fs]=(0,z.useState)(null),[ms,js]=(0,z.useState)(null),[ws,ks]=(0,z.useState)(!1),Is=M.default.useRef(0),Ds=e=>{Is.current=Date.now(),js(e)};M.default.useEffect(()=>{if(!ms)return;const e=setInterval(()=>{Date.now()-Is.current>=ze.DAY_IDLE_MS&&js(null)},5e3);return()=>clearInterval(e)},[ms]);const vs=(0,se.useWaitlist)(jt),Ss=(0,se.useStore)(e=>e.walkIns[jt]??0),[Cs,Ts]=(0,z.useState)(!1),[Rs,$s]=(0,z.useState)(!1),[Bs,Ws]=(0,z.useState)(!1),[Ls,Hs]=(0,z.useState)(!1);(0,X.useReviewAlerts)(jt);const[zs,Ms]=(0,z.useState)({view:0,content:0}),[Ps,As]=(0,z.useState)(null);M.default.useEffect(()=>{Ps&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Ps,timeoutMs:4500,big:!0,testID:'floor-toast'}),As(null))},[Ps]),M.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Es,Os]=(0,z.useState)(null),Ns=M.default.useRef(0),[_s,Gs]=(0,z.useState)(null);M.default.useEffect(()=>{if(!Es)return;Ns.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Ns.current;if(e>=Xe)return Os(null),void As('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Gs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Fs=e=>e.date!==Mt?ss({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Mt)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!hi.ok,accessibilityHint:hi.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),As(e)}}):null,e.walkIn?(0,qe.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Mt,onDone:e=>{ss(null),As(e)}}):null,(0,Se.bookingDetails)(e)]})}),Vs=It.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Us=Vs.filter(e=>!['cancelled','noshow'].includes(e.status)),Ks=kt.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,z.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),qs=(0,Be.closedAreasAt)(Ft,jt,Mt,(0,te.hm)(Ct)),Qs=[...qs].join(','),Js=(0,z.useMemo)(()=>(0,de.floorView)(_t,It,kt,Gt??{},Ct,wt.settings.turnMins,qs),[_t,It,kt,Gt,Ct.getTime(),Qs]),Xs=(0,ve.hoursFor)(wt,Ct),Zs=Xs?.open??new Date(`${Mt}T12:00:00`),el=Xs?.close??new Date(`${Mt}T21:00:00`),tl=(0,te.addMins)(Zs,-Zs.getMinutes()),sl=(0,te.addMins)(el,30),ll=e=>new Date(`${Mt}T${e}:00`),il=(0,Be.blocksOn)(Ft,jt,Mt).map(e=>({from:ll(e.from),to:ll(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Mt)),ol=Object.keys(Js).filter(e=>'blocked'===Js[e]?.status),nl=ms&&ms!==Mt?ms:Mt,al=nl!==Mt,rl=(0,ze.dayWord)(nl,Mt),dl=/^(Today|Yesterday|Tomorrow)$/.test(rl),cl=al?(0,ze.bookingsForDay)(It,nl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):Vs,ul=(0,te.parseYmd)(nl);ul.setHours(12);const hl=al?(0,ve.hoursFor)(wt,ul):Xs,gl=hl?.open??new Date(`${nl}T12:00:00`),bl=hl?.close??new Date(`${nl}T21:00:00`),yl=e=>new Date(`${nl}T${e}:00`),pl=[...al?(0,Be.blocksOn)(Ft,jt,nl).map(e=>({from:yl(e.from),to:yl(e.to),label:e.reason??'Paused'})):il,...al?(0,o.queuedServicePauses)(wt,ul,nl):[]],xl=(0,o.queuedServiceSessions)(wt,ul),fl=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),ml=(0,qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),jl=al?hl||cl.length?nlal?(0,de.dayFloorView)(_t,cl,nl):Js,[al,_t,cl,nl,Js]),[kl,Il]=(0,z.useState)(null),[Dl,vl]=(0,z.useState)(null),[Sl,Cl]=(0,z.useState)(!1),[Tl,Rl]=(0,z.useState)(null),$l=al?cl.filter(e=>!['cancelled','noshow'].includes(e.status)):Us,Bl=$l.reduce((e,t)=>e+t.partySize,0),Wl=(0,u.coversSplit)($l,nl),Ll=(0,Pe.cancelledDayTally)(It,nl),Hl=(0,Ae.cancellationsFor)(It,nl,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),zl=(0,Pe.cancelledTallyWords)(Ll,dl?rl.toLowerCase():al?`on ${rl}`:'today'),Ml=Ft.filter(e=>e.rid===jt&&e.date===nl&&!e.removedAt),Pl=(0,He.chartBands)(Ml,60*gl.getHours()+gl.getMinutes(),60*bl.getHours()+bl.getMinutes()),Al=new Set((0,He.blockedHours)(Pl)),El=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Ol=Ys.hours.filter(e=>e.hour>=El&&!Al.has(e.hour)),Nl=Ol.reduce((e,t)=>e+t.coversHigh,0),_l=Ol.reduce((e,t)=>e+t.coversLow,0),Gl=Math.round((_l+Nl)/2),Fl=!Ys.example&&Ys.open&&Ys.enough&&Nl>0?`Usually ${(0,c.coversRange)(Gl,Gl)} more`:void 0,Vl=async(e,t)=>{const s=Js[e]?.booking;if(!s||e===t)return;const l=Js[t]?.status;if(l&&!['free','soon'].includes(l))return void As('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(As,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),As(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,As)},Ul=e=>{if(xs)return vl(null),void fs(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);al?Il(e):Zt?(e!==Zt&&Vl(Zt,e),es(null)):Xt(e)},Kl=xs?It.find(e=>e.id===xs.id):void 0,Yl=xs&&Kl?(()=>{const e=Kl.walkIn?(0,fe.privName)(Kl,Ot):st(Kl.name),t=(0,De.seatsOf)(_t,xs.tables).total,s=(0,De.seatLine)(t,Kl.partySize),l=(0,De.pickClashes)(Kl,xs.tables,It.filter(e=>e.date===Kl.date),wt.settings.turnMins),i=(0,De.tableKey)(xs.tables)!==(0,De.tableKey)((0,re.tablesOf)(Kl.table));return(0,qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Kl.date,Mt)} ${Kl.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Kl.date,Mt)," ",Kl.time]}),(0,qe.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Dl?(0,qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Dl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,qe.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Dl})}):null,Sl&&Kl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Cl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,s,e,t,As)})()},onNo:()=>Cl(!1)}):null,(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:Dl?'plan-pick-overcap-yes':'plan-pick-save',label:Dl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Dl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Kl)return void fs(null);if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=(0,De.overCapacityAsk)(xs.tables,t,Kl.partySize);if(s&&!Dl)return void vl(s);if('finished'===Kl.status&&xs.tables.length&&!Sl)return void Cl(!0);vl(null),Cl(!1);const l=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,l,e,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),fs(null)}})]})]})})():null,ql=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),Ql=e=>{const t=_t.tables.filter(t=>t.areaId===e);return al?`${t.filter(e=>!wl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Js[e.name]?.status??'free')).length}/${t.length} free`},Jl='all'===qt||ql.some(e=>e.id===qt)?qt:'all',Xl=e=>(0,qe.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:wl,privacy:Ot,turnBase:wt.settings.turnMins,highlight:xs?xs.tables:Zt?[Zt]:void 0,onTap:e=>Ul(e.name),onDrop:(e,t)=>xs||al?void 0:Vl(e.name,t.name)}),Zl=ut?1:ht||ql.length>2?2:1,ei=e=>{const t=_t.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},ti=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),ft.w,ft.h):null,li=e=>(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:Ql(e.id)})]}),ii=(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-ft.w)>1||Math.abs(s-ft.h)>1)&&mt({w:t,h:s})},children:si?(0,qe.jsx)(U.default,{style:{flex:1},scrollEnabled:si.scroll,showsVerticalScrollIndicator:si.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:si.rows.map((e,t)=>(0,qe.jsx)(K.default,{style:{height:si.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=ql.find(t=>t.id===e);return(0,qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:si.cellW,gap:2},children:[li(t),(0,qe.jsx)(K.default,{style:{flex:1},children:Xl(e)})]},e)})},t))}):null}),oi=(0,qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:_t}),_t.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)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Q.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)(Q.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)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Jl,onPress:()=>Qt('all')},"__all"),...ql.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?qs.has(e.id)?'closed':Jl===e.id?Ql(e.id):void 0:void 0,selected:Jl===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(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;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(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:zs.view>0&&zs.content>0&&zs.content<=zs.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:zs.view>0&&zs.content<=zs.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),Yl,Zt?(0,qe.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,qe.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===Jl&>?ii:'all'===Jl?(0,qe.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ti.map((e,t)=>(0,qe.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ei(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{center:!0,children:Ql(e.id)})]}):(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{children:Ql(e.id)})]}),(0,qe.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ei(e.id)))}:{flex:1},children:Xl(e.id)})]},e.id)),e.length{if(al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},nl)}),ai='timeline'===Vt,ri=Kt?(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:le.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:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.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)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${al?(0,ze.dayLong)(nl):'Today'}`})}),rt<600?null:(0,qe.jsx)(K.default,{style:{minWidth:180}})]}),fl?ml:(0,qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:al?cl:Vs,now:al?gl:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:al?(0,te.addMins)(gl,-gl.getMinutes()):tl,t1:al?(0,te.addMins)(bl,30):sl,pauses:al?pl:il,blockedTables:al?[]:ol,onOpen:e=>{if(Yt(!1),al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},`full-${nl}`)})]})}):null,di=al?(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:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:dl?`Showing ${rl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(nl))}`:`Showing ${(0,ze.dayWord)(nl,Mt)}`}),(0,qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${zl}. Showing ${(0,ze.dayLong)(nl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{fs(null),Ds(null)},style:{minHeight:44}})]}):null,ci=(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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(ai||Kt);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?(Ut('plan'),Yt(!0)):(Yt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.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)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ui='display'===I.APP_VARIANT&&!e?(0,qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ci,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:$t,staff:Tt,today:Mt,leave:Bt})]}):ci,hi=(0,h.useBookingWrite)(),gi=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint})]});(0,Ye.useDisplayNotices)(jt,!e);const bi=!e&&!I.IS_CAR&&!ut,yi=ut?180:202,[pi,xi]=(0,z.useState)(ut?180:168),fi=M.default.useRef(ut?180:168),mi=M.default.useRef(null),ji=M.default.useRef(null),wi=M.default.useRef(null),ki=!ut&&ct<=800,Ii=()=>{const e=mi.current,t=ji.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l)=>{const i=t>fi.current?Math.ceil(t-fi.current):0,o=Math.max(Le.DAY_GRAPH_CHROME+(ki?24:8),i),n=!ut&&ct>=700?140:70,a=Math.floor(s-4-e)-o-l,r=Math.min(yi,a>=n?Math.max(n,a):Math.max(0,a));Math.abs(fi.current-r)>=2&&(fi.current=r,xi(r))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,o,n,a)=>{t.measureInWindow((e,t)=>{const n=wi.current;bi&&n?.measureInWindow?n.measureInWindow((e,l,n,r)=>{const d=ct<820?4:8;s(o,a,t,Math.max(i,44+d+Math.round(r||0)))}):s(o,a,t,bi?i:l)})})};M.default.useEffect(()=>{const e=setTimeout(Ii,60);return()=>clearTimeout(e)},[rt,ct]);const Di=(0,qe.jsxs)(K.default,{ref:ji,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ii()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:ki?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ke.DisplayClockButton,{}),(0,qe.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Gs(null),Os({at:Date.now()})},onHint:()=>As('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:Ht,quiet:!0,display:!0,day:nl}),_t.areas.some(e=>e.outdoor)?(0,qe.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,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:()=>Hs(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(x.GiftQrButton,{rid:jt,venue:wt.name})]}),vi=Ks.length?(0,qe.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ks.length," live"]})]}),(0,qe.jsx)(K.default,{style:{padding:10},children:(0,qe.jsx)(at,{list:Ks,me:Ht,compact:!0,bookings:It})})]}):null,Si=(Oe.DueToday,wt.settings.turnMins||90),Ci=al?cl:(0,v.todaysGuestList)(Vs,Ct,Si),Ti=al?[]:(0,v.todaysFinishedList)(Vs,Ct,Si),Ri=al?dl?`${rl}\u2019s guests`:`Guests ${rl}`:'Today\u2019s guests',$i=(0,qe.jsxs)(qe.Fragment,{children:[0===Ci.length?(0,qe.jsx)(Q.Muted,{children:al?nl{const t=(0,v.isLeftEarly)(e,Ct,Si),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:al})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,o=s?le.colours.goldLight:le.colours.muted,n=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:al?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:l.time}),(0,qe.jsx)(Q.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)(_.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,qe.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?o:i,children:l.table}),l.dog?(0,qe.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ti.length?(0,qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ti.length}${gs?', expanded':', collapsed'}`,accessibilityState:{expanded:gs},onPress:()=>bs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",Ti.length,")"]}),(0,qe.jsx)(Q.T,{size:16,colour:le.colours.muted,children:gs?'\u25be':'\u25b8'})]}),gs?Ti.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(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:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Q.T,{size:15,colour:le.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:jt,today:Mt,who:t.name,allowed:hi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ee.CancellationsSection,{items:Hl,dayWord:al?dl?rl.toLowerCase():`on ${rl}`:'today'})]}),Bi=(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:$i}),Wi=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&&hs(!1)}}),Li=(0,qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ri}, ${Ci.length}`,accessibilityState:{expanded:us},'aria-expanded':us,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:Ci.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)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[Ri," ",us?'\u2039':'\u203a']})})})]}),Hi=us?(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",...Wi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.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,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Ri.toUpperCase()," (",Ci.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Ri}`,onPress:()=>hs(!1),style:{marginRight:-6}})]}),Ll.count?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:zl}):null]}),Bi]}),(0,qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ri}`,accessibilityRole:"button",onPress:()=>hs(!1),style:{flex:1}})]}):null,zi=fl?ml:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:cl,open:gl,close:bl,now:Ct,turnBase:wt.settings.turnMins,blocks:Ml,pauses:pl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?pi:yi,forecastNote:al?void 0:Fl,emptyText:jl,past:nl{Is.current=Date.now(),ks(!0)},shortDay:!ut&&rt<1100}),Ai=(0,qe.jsx)(Me.DisplayCalendar,{visible:ws,today:Mt,day:nl,bookings:It,restaurant:wt,now:Ct,onDay:Ds,onClose:()=>ks(!1)}),Ei=()=>{al?hs(!0):Yt(!0)},Oi=(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ki?4:ct<820?8:12,paddingTop:ki?bi?2:4:ct<820?bi?4:6:bi?8:10,gap:ki?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:di,Pt?(0,qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,today:Mt,app:"display"})}):ai?ni:oi,ri,Hi]}),(0,qe.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:gi(!1)}),(0,qe.jsx)(K.default,{style:{flexShrink:0},children:ui}),Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:ct<820,snug:ct<820,tight:ct<800,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{ref:mi,testID:"day-graph-slot",onLayout:Ii,style:{flexGrow:0,flexShrink:1,flexBasis:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),height:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),minHeight:ct<=600?90:Math.min((ut?yi:pi)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:Mi}),(0,qe.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[bi?null:(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),vi,(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht})]}),bi&&!Pt?(0,qe.jsx)(K.default,{ref:wi,testID:"display-side-split",style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})}):null]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{Is.current=Date.now()},onMouseDown:()=>{Is.current=Date.now()},children:[ut?(0,qe.jsxs)(K.default,{style:{flex:1},children:[(0,qe.jsxs)(U.default,{ref:pt,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)(Z.RestaurantLogo,{rid:jt,size:64}),(0,qe.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,qe.jsx)(Z.PoweredBy,{}),(0,qe.jsx)(H.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,qe.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:"m"}),(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt}),Pi,(0,qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(ot,{phone:!0,split:Wl,items:[{label:`Tables \xb7 ${rl}`,value:$l.length,testID:'badge-tables'},{label:`Covers \xb7 ${rl}`,value:Bl,testID:'badge-covers'},{label:'Takeaway',value:Ks.length,alert:Ks.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:gi(!0)}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),ui,(0,qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ai?ni:oi,ri]}),(0,qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[Ri," (",Ci.length,")"]}),(0,qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{gap:4},children:$i})]}),vi,Mi,(0,qe.jsx)(K.default,{testID:"covers-dock",children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.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)(Q.T,{center:!0,size:14,colour:Ot?le.colours.muted:le.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,qe.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Di]}),e?null:(0,qe.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:le.colours.hairline},children:(0,qe.jsx)(N.VoiceSlot,{size:56})})]}):(0,qe.jsxs)(qe.Fragment,{children:[bi?(0,qe.jsxs)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,n.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.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})}),(0,qe.jsx)(V.default,{testID:"display-more",accessibilityRole:"button",accessibilityLabel:"More",onPress:()=>Ws(!0),style:({pressed:e})=>({minWidth:44,height:44,marginLeft:8,paddingHorizontal:10,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center',flexShrink:0}),children:(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.muted,children:"More"})})]}):null,(0,qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ki?2:ct<820?4:8,gap:8,minHeight:ki&&bi?44:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,qe.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Pt?(0,qe.jsx)(K.default,{style:{width:220}}):(0,qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Pi}),(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:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Pt?null:(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,qe.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.muted,children:"?"})}),'simulated'===St?(0,qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,e?null:(0,qe.jsx)(j.ExitButton,{}),ee,Ue?null:(0,qe.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,I.IS_CAR||!Pt||bi?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Pt||bi?null:(0,qe.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,qe.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(K.default,{style:tt,children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})})]})}),gt?Oi:(Ni=(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:gi(!1)}),ui]}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),Pt?(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,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:[Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[di,ai?ni:oi,ri,Hi]})]})}),vi,Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:yi+Le.DAY_GRAPH_CHROME},children:Mi})]}),(0,qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Ni})),Di]}),(0,qe.jsx)($.SoldOutStrip,{rid:jt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:Ls,onClose:()=>Hs(!1),rid:jt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:jt}),At.elements,os?(0,qe.jsx)(y.EditBookingPicker,{rid:jt,today:Mt,who:Ht,onClose:()=>ns(!1)}):null,as?(0,qe.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:Ht,onClose:()=>rs(null)}):null,Jt?(0,qe.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Js,plan:_t,todays:Vs,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Fs}):null,kl?(()=>{const e=wl[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Rl(null),Il(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${dl?rl:(0,ze.dayLong)(nl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${dl?rl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${dl?rl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):st(e.name);return(0,qe.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Il(null),ps(e.id)},style:{minHeight:56}},e.id)}),nl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===nl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(kl)).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)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Tl?(0,qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Tl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Tl.ask}),(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!hi.ok,accessibilityHint:hi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Tl.id);if(Rl(null),!e)return;const s=st(e.name);Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Rl(null)})]})]}):null,Tl?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,qe.jsx)(Q.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:!hi.ok,accessibilityHint:hi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(As,{b:e,tables:[kl]}))return;const l=(0,De.overCapacityAsk)([kl],t,e.partySize);l?Rl({id:e.id,ask:l}):(Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Rl(null),Il(null)},style:{minHeight:56}})]})})():null,ys?(()=>{const e=It.find(e=>e.id===ys);return e?(0,qe.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):st(e.name),view:Js,now:Ct,otherDay:e.date!==Mt,turnBase:wt.settings.turnMins,onClose:()=>ps(null),onDetails:Fs,onDone:As,onEdit:e=>{ps(null),rs(e.id)},onPickOnPlan:(e,t)=>{hs(!1),Ut('plan'),Qt('all'),fs({id:e.id,tables:t})}}):null})():null,ts?(0,qe.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,Ai,ds?(0,qe.jsx)(Se.ServiceSummary,{r:wt,todays:Vs,orders:kt,waitlistAll:vs,walkInCount:Ss,onClose:()=>cs(!1)}):null,Cs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ts(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ts(!1)})]}):null,Bs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ws(!1),$s(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,Rs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,ls?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,qe.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(at,{list:Ks,me:Ht,bookings:It})]}):null,Es?(0,qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,qe.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Ns.current=Date.now(),null!==_s&&Gs(null)},notice:null!==_s?`Locking again in ${_s} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Os(null),As('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),As('Live seating plan updated on every screen.')},onCancel:()=>{Os(null),As('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,qe.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,qe.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,qe.jsx)(Re.TakeawayTakeover,{rid:jt,me:Ht})]});var Ni}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); __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},1348,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1349,[1005,1073]); @@ -1488,7 +1488,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";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}:{}}))}},1405,[]); __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)}},1406,[879,859,878]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1407,[5,1007,904,958]); -__d(function(g,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,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:w,blocks:M=[],height:v=150,forecastNote:k,emptyText:$,past:D,closed:A,compact:I=!1,dense:C=!1,bare:L=!1,fill:_=!1,fit:z=!1,tight:H=!1,live:O=!1}){const[S,F]=(0,t.useState)(0),[P,R]=(0,t.useState)(0),N=j.getTime()-18e5,B=T.getTime()+36e5,E=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(N),new Date(B),w),[e,N,B,w]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(M,W,X),[M,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=z&&P?Math.max(24,Math.floor(P)):Math.max(48,v-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=C?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:O,past:D,closed:A}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},he=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),de=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&de.push(t.getTime())}const ue=O?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),xe=A?null:O?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,ge=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:de,busiest:xe}):{hours:[],busiest:null},me=he(E),pe=le?he(ae.before):me,fe=le?he(ae.after):'',ye=_&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,we=ge.busiest?.text??(A?'':O?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),Me=U.map(e=>e.spoken).join('. '),ve=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${we?` ${we}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${ve} percent of the way through the day.`:''}${Me?` ${Me}.`:''}`,$e=(0,u.hm)(b),De=Math.max(44,12*$e.length*.7+16),Ae=Math.max(q+2,Math.min(Math.max(0,S-J-De),se(re)-De/2)),Ie=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,z?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:L?4:C?2:10,paddingBottom:L?2:6,backgroundColor:c.colours.bg}],children:[L?null:I?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),L||H?null:A?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ke,onLayout:e=>{F(e.nativeEvent.layout.width),z&&R(e.nativeEvent.layout.height)},style:z?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,v-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,A?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,ge.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:ge.busiest.x+ge.busiest.w/2,y:ge.busiest.y+ge.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:ge.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Ae,top:Ie,minWidth:De,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),ge.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':i(0,f.coverCurve)(e,new Date(N),new Date(B),v),[e,N,B,v]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(w,W,X),[w,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=O&&P?Math.max(24,Math.floor(P)):Math.max(48,M-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=A?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:$,closed:I}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},de=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),he=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&he.push(t.getTime())}const ue=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),ge=I?null:H?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,xe=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:he,busiest:ge}):{hours:[],busiest:null},me=de(E),pe=le?de(ae.before):me,fe=le?de(ae.after):'',ye=z&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ve=xe.busiest?.text??(I?'':H?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),we=U.map(e=>e.spoken).join('. '),Me=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=!I&&K&&K.covers?(0,m.peakOccupancyText)(K.t,K.covers):'',De=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${ke?` ${ke}.`:''}${ve?` ${ve}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${Me} percent of the way through the day.`:''}${we?` ${we}.`:''}`,$e=(0,u.hm)(b),Ie=Math.max(44,12*$e.length*.7+16),Le=Math.max(q+2,Math.min(Math.max(0,S-J-Ie),se(re)-Ie/2)),Ae=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[h.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:C?4:A?2:10,paddingBottom:C?2:6,backgroundColor:c.colours.bg}],children:[C?null:L?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te}),ke?(0,y.jsx)(d.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:ke}):null]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:A?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),C||_?null:I?k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),ke&&!L?(0,y.jsx)(d.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:ke}):k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),C||_||L||!k||!ke?null:(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),C||!_||!ke||L?null:(0,y.jsx)(d.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:ke}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:De,onLayout:e=>{F(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,xe.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:xe.busiest.x+xe.busiest.w/2,y:xe.busiest.y+xe.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:xe.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(d.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Le,top:Ae,minWidth:Ie,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(d.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),xe.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1409,[]); __d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1410,[1092]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1411,[861,1390]); diff --git a/owner-app/admin.html b/owner-app/admin.html index 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 23c517e779359009028a3ba42bd05315ab0fae12..27dac7911f35d2210cc842b69dccc09f33c15c7c 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 78fc770a9ca79b7ee958dddf5eaae7572d31f1b2..4ceb5a5f2aee819f03d12c3524ddfef67b66be63 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-a0e46eb86c"; +const V = "cc-owner-c8b60c8ad7"; 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=a0e46eb86c3b9448d1846fc69a54384a976f81ea81c63f147d2dabf1d7374db1"]; +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=c8b60c8ad7bf4e64c41f8105bd3e61caddc365701c02d47bebf6a07f3235884d"]; // 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 2d7150b2e903e5ac86b14acfde21303174b31475..7385894790b167d5bf1578e28a4af836aca434f6 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 16f3ca6b401be753c29603da2e68b81082a94645..b132fcd196d7375fc9ac355f58295cdd8b822732 100644 --- a/owner-desktop/_expo/static/js/web/bundle.js +++ b/owner-desktop/_expo/static/js/web/bundle.js @@ -5,7 +5,7 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() !(function(r){let l=0,n=!0===r.RN$useAlwaysAvailableJSErrorHandling?r.RN$handleException:(r,l)=>{throw r};const t={setGlobalHandler(r){n=r},getGlobalHandler:()=>n,reportError(r){n&&n(r,!1)},reportFatalError(r){n&&n(r,!0)},applyWithGuard(r,n,e,a,o){try{return l++,r.apply(n,e)}catch(r){t.reportError(r)}finally{l--}return null},applyWithGuardIfNeeded:(r,l,n)=>t.inGuard()?r.apply(l,n):(t.applyWithGuard(r,l,n),null),inGuard:()=>!!l,guard(r,l,n){if('function'!=typeof r)return console.warn('A function must be passed to ErrorUtils.guard, got ',r),null;const e=l??r.name??'';return function(...l){return t.applyWithGuard(r,n??this,l,null,e)}}};r.ErrorUtils=t})('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof global?global:'undefined'!=typeof window?window:this); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,20]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&!t.PITCH_ANCHORAGE&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=o=>{if(3===o.nodeType){const e=o.nodeValue??'',a=(0,n.pitchText)(e,t.PITCH_ANCHORAGE);return void(a!==e&&(o.nodeValue=a))}if(1!==o.nodeType)return;const a=o;if('INPUT'===a.tagName||'TEXTAREA'===a.tagName){const e=a,o=(0,n.pitchText)(e.value,t.PITCH_ANCHORAGE);o!==e.value&&(e.value=o);const i=e.getAttribute('placeholder');if(i){const o=(0,n.pitchText)(i,t.PITCH_ANCHORAGE);o!==i&&e.setAttribute('placeholder',o)}}for(const e of['aria-label','title']){const o=a.getAttribute(e);if(o){const i=(0,n.pitchText)(o,t.PITCH_ANCHORAGE);i!==o&&a.setAttribute(e,i)}}a.childNodes.forEach(e)},o=()=>{e(document.body),document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE),new MutationObserver(o=>{for(const t of o)'characterData'===t.type?e(t.target):t.addedNodes.forEach(e),'attributes'===t.type&&e(t.target);document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?o():document.addEventListener('DOMContentLoaded',o)}}},1,[2,3,16,18,19]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!0},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!1},2,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return c.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return R}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]);const u={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[6]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},h={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},f={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},b={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},p=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:f,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...u,orderAtTable:!1,pay:h,cashUpRecord:[...l.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:8,bookingNoticeMins:15,autoAcceptUpTo:8},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...u,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],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']},settings:{...u,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],A={by:'Fictional demo',at:'2026-10-26'},T=(t,n,o,s,c,l,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:c,price:l,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:A}),R=[T('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),T('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),T('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),T('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),T('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),T('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),T('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),T('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),T('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),T('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13,15]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="anchorage".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); @@ -1070,7 +1070,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()})},987,[35,988]); __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},988,[985,948,989]); __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'}},989,[985]); -__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.189'},990,[]); +__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.190'},990,[]); __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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},991,[992,993,904,948,988]); __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())}}}},993,[948]); @@ -1244,7 +1244,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 e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1161,[35,403,103,795,868,822,1154,1153,1158,1011,26]); __d(function(g,_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.ChefForecast=function({openPrep:e}){const{r:f,rid:y,now:b}=(0,u.useChef)(6e4),x=(0,l.useBookings)(y),p=(0,l.useOrders)(y),j=(0,l.useEvents)(y),k=(0,a.useRealHistory)(y,b),w=(0,d.ymd)(b),[T,$]=(0,o.useState)(7),{covers:v,enough:C,booked:D,pct:I,day:A,example:L}=(0,u.useForecast)(),M=0===I?`about a usual ${A}`:`${Math.abs(I)}% ${I>0?'busier':'quieter'} than a usual ${A}`,z=(0,o.useMemo)(()=>Array.from({length:T},(e,o)=>{const s=0===o?b:(0,d.addMins)((0,d.parseYmd)(w),1440*o),t=(0,i.forecastToday)(f,x,p,j,s,k??void 0);return{d:s,f:t,booked:t.hours.reduce((e,o)=>e+o.booked,0),covers:t.hours.reduce((e,o)=>e+o.covers,0)}}),[f,x,p,j,w,T,k,b.getTime()/6e5|0]),B=z[0].f,R=z.map(e=>({key:(0,d.ymd)(e.d),label:(0,d.dayShort)(e.d),spoken:(0,d.dayLong)(e.d),value:e.f.open?C?e.covers:e.booked:0,open:!!e.f.open}));return(0,h.jsxs)(t.default,{style:{gap:12},testID:"chef-forecast",children:[(0,h.jsx)(r.Muted,{center:!0,testID:"chef-forecast-busy",children:B.busy.words}),C?null:(0,h.jsx)(a.NotEnoughHistory,{weeks:B.minWeeks,booked:D}),(0,h.jsxs)(r.Card,{children:[(0,h.jsxs)(t.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,h.jsxs)(r.T,{center:!0,weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:[7===T?'This week':`Next ${T} days`," \xb7 ",C?'forecast covers':'booked covers']}),C?B.example?(0,h.jsx)(a.ExampleBadge,{}):(0,h.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"}):null]}),(0,h.jsx)(r.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,h.jsx)(r.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:T===e,onPress:()=>$(e),testID:`chef-forecast-range-${e}`},e))}),(0,h.jsx)(c.DaysLineGraph,{days:R,titleSpoken:`${C?'Forecast':'Booked'} covers for the next ${T} days`})]}),(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:"Covers per day"}),(0,h.jsxs)(t.default,{testID:"chef-forecast-days",children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',paddingVertical:6,borderBottomWidth:1,borderColor:n.colours.hairline},children:[(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{flex:1,textAlign:'left'},children:"Day"}),(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:72,textAlign:'right'},children:"Booked"}),C?(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:84,textAlign:'right'},children:"Forecast"}):null]}),z.map((e,o)=>{const s=0===o;return(0,h.jsxs)(t.default,{testID:`chef-forecast-day-${(0,d.ymd)(e.d)}`,accessible:!0,accessibilityLabel:e.f.open?`${(0,d.dayLong)(e.d)}: ${e.booked} booked${C?`, about ${e.covers} forecast`:''}`:`${(0,d.dayLong)(e.d)}: closed`,style:{flexDirection:'row',alignItems:'center',minHeight:40,borderBottomWidth:o({minHeight:48,borderRadius:12,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:e?n.colours.goldTint:'transparent'}),children:(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,children:"Open prep list \u203a"})})]})]})};var o=_r(_d[0]),s=e(_r(_d[1])),t=e(_r(_d[2])),r=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),d=_r(_d[6]),n=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11])},1162,[35,403,103,795,875,1155,859,822,1163,1159,1158,26]); __d(function(g,_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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1163,[829,35,284,365,237,103,427,798,795,828,822,1164,26]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,l=u,f=Math.max(10,i-s-l),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let M=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(p=n.busiest.t,s+(p-n.t0)/x*f-o/2);M={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var p;return{hours:b,busiest:M}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xf+(t-c)/M*b,w=l.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:p(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',f=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=l.indexOf(n);return t+(o<0?1e3:f[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.peakOccupancyText=function(t,n){const o=String(new Date(t).getHours()).padStart(2,'0');return`Peak ${n} ${1===n?'cover':'covers'} at ${o}:00`},e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,f=u,l=Math.max(10,i-s-f),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let p=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(M=n.busiest.t,s+(M-n.t0)/x*l-o/2);p={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var M;return{hours:b,busiest:p}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xl+(t-c)/p*b,w=f.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:M(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',l=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=f.indexOf(n);return t+(o<0?1e3:l[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); __d(function(g,_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.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,I.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,I.useForecast)(),f=(0,k.ymd)(i),p=(0,R.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),m=p.reduce((e,t)=>e+t.sold,0)||1,x=p.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/m)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),b={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{b[e.ing]=(b[e.ing]??0)+e.qty*t.qty}));const y=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini-fish-goujons','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,$.fmtQty)(Math.ceil(2*(b.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,$.fmtQty)(Math.ceil(10*(b.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,$.fmtQty)(Math.ceil(10*(b.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,$.fmtQty)(Math.ceil(2*(b.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,D.useKitchen)(e=>e.tickPrep),w=[...y.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=w.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,q.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,q.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} Covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,q.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} Covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," Covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,q.jsx)(u.Badge,{kind:S===w.length?'ok':'gold',label:`${S}/${w.length} done`})]}),w.map((t,i)=>{const n=e.prepTicks[t.key];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?C.colours.ok:C.colours.border,backgroundColor:C.colours.surface,marginTop:i===y.length?8:0},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:C.colours.muted}:void 0,children:t.text}),n?(0,q.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,q.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,I.useChef)(),a=(0,I.useWeek)(),d=(0,D.useKitchen)(e=>e.addWaste),[f,p]=(0,o.useState)(e.ingredients[0]?.id),[m,x]=(0,o.useState)(''),[b,y]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),k=Number(m.replace(',','.'))||0,S=k>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*k)),T=w&&S?(0,s.inputQuantity)(l,w,k):0,v=e.waste.filter(e=>(0,I.within7)(e.at,r));return w?(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,q.jsx)(I.Tile,{label:"Waste this week",value:(0,j.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,q.jsx)(I.Tile,{label:"Waste as % of food sales",value:a.sales?(0,I.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,q.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,q.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,q.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>p(e.id)},e.id))})}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:m,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:C.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),(0,q.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,q.jsx)(u.T,{weight:"semibold",colour:C.colours.gold,children:(0,j.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,q.jsxs)(u.Row,{children:[(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(k)-.5)))}),(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(k)+.5))}),(0,q.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:D.WASTE_REASONS.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===b,onPress:()=>y(e)},e))}),(0,q.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:b,cost:Math.round(T*w.cost)}),x('')}}),(0,q.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,q.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,q.jsx)(u.T,{size:14,children:(0,j.gbp)(e.cost)})]},e.id))]}):(0,q.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,I.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,b.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'},c=(0,m.useUnsignedDishes)(i),[x,j]=(0,o.useState)(!1);return x?(0,q.jsx)(m.UnsignedDishList,{rid:i,actor:a,onClose:()=>j(!1),onOpenCards:e}):(0,q.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,q.jsx)(d.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>j(!0),style:({pressed:e})=>({minHeight:48,opacity:e?.85:1}),children:(0,q.jsxs)(u.Card,{style:{alignItems:'center'},highlight:c.length?C.colours.amber:void 0,children:[(0,q.jsx)(u.Muted,{center:!0,children:"Dishes not signed off"}),(0,q.jsx)(u.T,{center:!0,size:20,weight:"bold",children:c.length})]})}),(0,q.jsx)(u.Muted,{children:"The 14 allergens from each recipe card. These are what guests see on the menu, takeaway and the booking allergy check. A red warning means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,q.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,l.map(({card:e,fromCosting:t})=>(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",center:!0,children:e.dish}),(0,q.jsx)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i,r='contains'===i?'Contains':'may'===i?'May contain':n?'In costing recipe, not on card':'Not listed';return(0,q.jsxs)(h.default,{accessible:!0,accessibilityLabel:`${e.dish}, ${s.label}: ${r}`,style:{flexGrow:1,flexBasis:220,minWidth:180,maxWidth:'100%',padding:8,borderRadius:8,backgroundColor:n?C.colours.redBg:C.colours.surface2},children:[(0,q.jsx)(u.T,{center:!0,size:14,weight:"semibold",children:s.label}),(0,q.jsx)(u.T,{center:!0,size:14,colour:n?C.colours.red:'contains'===i?C.colours.gold:C.colours.muted,children:r})]},s.id)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Not listed means the allergen is not recorded on this recipe card. Check any costing warnings before sign-off."}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,q.jsxs)(u.Card,{highlight:s.length?C.colours.red:C.colours.amber,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,q.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,q.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,q.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,p.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,q.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,q.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,I.useChef)(),l=(0,k.ymd)(i),a=(0,D.useKitchen)(e=>e.addTemp),c=(0,x.useOwner)(e=>e.checks),{tick:f,untick:p}=x.useOwner.getState(),[m,b]=(0,o.useState)('fridge'),y=E.find(e=>e.id===m),j={...y,units:y.units.filter(e=>(0,n.chefCanSee)(r,e))},[w,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,M=e.temps.filter(e=>e.at.slice(0,10)===l),B=(e,t,i)=>{const n=c[e];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?p(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,children:t}),(0,q.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:E.map(e=>(0,q.jsx)(u.Chip,{label:e.label,selected:e.id===m,onPress:()=>{b(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===w,onPress:()=>S(e)},e))}),(0,q.jsx)(u.Muted,{children:j.rule}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:C.colours.muted,style:{width:90,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),null===$?null:(0,q.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,q.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:m,unit:w,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,q.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",M.length,")"]}),M.length?M.map(e=>{const t=E.find(t=>t.id===e.kind)?.ok(e.temp);return(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,q.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,q.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?C.colours.ok:'warn'===t?C.colours.amber:C.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,q.jsx)(u.Muted,{children:"None yet today."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,q.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),G.map(e=>B(`${l}:kc-${e.id}`,e.text))]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),F.map(e=>B('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,I.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,v.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??I.CHEF_ID,role:'staff'}),[d?.id]),u=(0,T.useChatOpen)(e=>e.ch);return(0,o.useEffect)(()=>{u&&a('chat')},[u]),(0,q.jsx)(S.ChatAsCtx.Provider,{value:c,children:(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(H,{sub:r,setSub:a}),'live'===r?(0,q.jsx)(_,{}):'soldout'===r?(0,q.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,q.jsx)(V,{}):(0,q.jsx)(U,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),D=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),z=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]),N=_r(_d[36]),W=_r(_d[37]),q=_r(_d[38]);const E=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],F=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],G=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function H({sub:e,setSub:t}){const{total:s}=(0,S.useChatUnread)();return(0,q.jsx)(I.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function U(){return(0,q.jsx)(S.Chat,{go:()=>{}})}function _(){const{rid:e,r:t,me:s,now:i}=(0,I.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))),c=(e,t)=>!!(0,B.statusBlock)(e,t,(0,B.linkedBooking)(e,n)),p=(0,b.ticketView)('chef',d),m=(0,f.useStore)(e=>e.setOrderStatus),x=(0,f.useStore)(e=>e.ackReadiness),j=d.flatMap(e=>(0,w.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,q.jsxs)(h.default,{style:{gap:8},children:[j.length?(0,q.jsx)(u.Banner,{kind:"warn",title:`${j.length} readiness alert${j.length>1?'s':''}`,children:j.map(e=>e.detail).join(' \xb7 ')}):(0,q.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,q.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,p.length?p.map(e=>(0,q.jsxs)(u.Card,{highlight:e.allergies.length&&(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))&&'ready'!==e.status?C.colours.red:void 0,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`Table ${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,q.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,q.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,q.jsxs)(u.T,{size:13,colour:C.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,q.jsx)(M.AllergyChain,{o:e,me:s}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{m(e.id,'preparing',s),'takeaway'===e.type&&x(e.id,'cook',s)}}):null,'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>m(e.id,'ready',s)}):null]})]},e.id)):(0,q.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const K=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,k.ymd)(new Date(s,i-1,n+t))};function V(){const{now:e,today:t}={...(0,I.useChef)(6e4),today:(0,k.ymd)(new Date)},{staff:s,shifts:i}=(0,b.rotaView)('chef',(0,x.useOwner)(e=>e.staff),(0,x.useOwner)(e=>e.shifts)),n=(0,x.useOwner)(e=>e.leave),r=(0,N.canEditKitchenRota)((0,P.useSync)(e=>e.perms)),l=(0,x.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),a=(0,v.weekday)(e),o=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),d=(0,z.useSession)(e=>e.meId),c=(0,P.useSync)(e=>e.staffRef),f=d??c??I.CHEF_ID,p=(0,x.useOwner)(e=>e.staff.find(e=>e.id===f)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(L.BreakRoomCard,{staffId:f,name:p,now:e}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"On now"}),l.length?l.map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,q.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,q.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",v.DAY3[a],")"]}),i.filter(e=>e.date===t).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,W.leaveCovering)(n,e.staffId,e.date)?(0,q.jsx)(u.T,{size:13,colour:C.colours.blue,children:(0,W.leaveLabel)((0,W.leaveCovering)(n,e.staffId,e.date))}):(0,q.jsxs)(u.Muted,{children:[(0,v.fmtH)(e.start),"\u2013",(0,v.fmtH)(e.end)]})]},e.id))]}),r?(0,q.jsx)(u.Card,{children:(0,q.jsx)(A.KitchenRotaEditor,{today:t})}):(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),o.map(e=>(0,q.jsxs)(h.default,{style:{gap:4},children:[(0,q.jsx)(u.T,{size:14,children:e.name}),(0,q.jsx)(u.Row,{wrap:!0,gap:4,children:v.DAY3.map((s,n)=>{const r=i.find(s=>s.staffId===e.id&&s.date===K(t,n-a));return(0,q.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:r?C.colours.goldTint:C.colours.surface2,alignItems:'center'},children:[(0,q.jsx)(u.T,{size:10,colour:C.colours.muted,children:s}),(0,q.jsx)(u.T,{size:10,children:r?`${(0,v.fmtH)(r.start).slice(0,2)}\u2013${(0,v.fmtH)(r.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})]})}},1165,[828,955,1166,836,861,1167,1168,35,403,296,103,795,875,883,1169,892,966,862,868,1172,859,822,1173,1099,1073,1154,1153,1174,870,1158,1011,896,1175,977,958,1178,961,1087,26]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1166,[1153,955]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1167,[828,35,103,795,875,950,892,951,952,953,832,822,26]); @@ -1261,7 +1261,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";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=w,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,l.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,y.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,y.jsx)(w,{today:e}):(0,y.jsx)(I,{today:e})})},_e.KitchenRotaRead=I;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],j=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,k=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,p=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function w({today:e=(0,h.ymd)(new Date)}){const r=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,l.kitchenTeam)(r),[r]),$=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[w,I]=(0,t.useState)(0),S=(0,f.useDateCalendar)(),[v,C]=(0,t.useState)(null),[T,H]=(0,t.useState)(''),P=(0,a.addDays)((0,a.mondayOfDate)(e),7*w),L=(0,a.addDays)(P,6),R=b.map((e,t)=>(0,a.addDays)(P,t)),M=(0,l.kitchenPending)(o,$,P,L).length,O=e=>{H(e),(0,u.announce)(e)},W=0===w?'This week':1===w?'Next week':-1===w?'Last week':`Week of ${k(P)}`;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center',flexWrap:'nowrap'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(w-1),H('')},style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${W}, ${x[0]} ${k(P)} to ${x[6]} ${k(L)}`,style:{alignItems:'center',minWidth:120,flex:1},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:W}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(P)," \u2013 ",j(L)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(w+1),H('')},style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:S.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:S.calOpen,today:e,day:P,showBusy:!0,idPrefix:"krota-cal",onClose:S.closeCal,onDay:t=>{I((0,f.weekOffsetOf)(t??e,e)),H('')}}),d.map(t=>(0,y.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[p(t.nickname||t.name),t.job?(0,y.jsx)(n.T,{size:12,colour:m.colours.muted,children:` ${t.job}`}):null]}),(0,y.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:R.map((i,a)=>{const l=o.find(e=>e.staffId===t.id&&e.date===i),r=!(!l||l.published&&!l.changed),d=`${p(t.nickname||t.name)}, ${x[a]} ${k(i)}, ${l?`${(0,c.fmtH)(l.start)} to ${(0,c.fmtH)(l.end)}${r?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,y.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>C({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:r?'dashed':'solid',borderColor:l?r?m.colours.amber:m.colours.gold:m.colours.border,backgroundColor:e||l?m.colours.goldTint:m.colours.surface2}),children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:i===e?m.colours.gold:m.colours.muted,children:b[a]}),(0,y.jsx)(n.T,{size:10,center:!0,children:l?`${(0,c.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(l.end).slice(0,5)}):(0,y.jsx)(n.T,{size:10,center:!0,colour:m.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,y.jsx)(n.Button,{testID:"krota-publish",kind:M?'primary':'secondary',disabled:!M,label:M?`Publish kitchen rota (${M} ${1===M?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:M?`Publish the kitchen rota for ${W.toLowerCase()}, ${M} ${1===M?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,$,P,L);a.useOwner.getState().setShifts(e.shifts),O(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,y.jsx)(i.default,{testID:"krota-msg",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.goldLight,children:T})}):null,(0,y.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),v?(0,y.jsx)(D,{init:v,onClose:()=>C(null),onSaid:O}):null]})}function I({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:l}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,$]=(0,t.useState)(0),w=(0,f.useDateCalendar)(),I=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),D=(0,a.addDays)(I,6),S=b.map((e,t)=>(0,a.addDays)(I,t)),v=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),C=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${k(I)}`,[T,H]=(0,t.useState)(0),P=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>H(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>$(u-1),style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${C}, ${x[0]} ${k(I)} to ${x[6]} ${k(D)}`,style:{alignItems:'center',minWidth:120},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:C}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(I)," \u2013 ",j(D)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>$(u+1),style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:w.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:w.calOpen,today:e,day:I,showBusy:!0,idPrefix:"krota-read-cal",onClose:w.closeCal,onDay:t=>$((0,f.weekOffsetOf)(t??e,e))}),v.map(t=>(0,y.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:p(t.nickname||t.name)}),(0,y.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=l.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,r.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,r.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,y.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${p(t.nickname||t.name)}, ${x[a]} ${k(s)}, ${u}`,style:{width:P,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.goldTint:m.colours.surface2},children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:s===e?m.colours.gold:m.colours.muted,children:b[a]}),o&&h?(0,y.jsx)(n.T,{size:9,center:!0,colour:m.colours.blue,children:(0,r.leaveLabel)(h).toLowerCase()}):(0,y.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),v.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,y.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function D({init:e,onClose:s,onSaid:r}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=p(o?.nickname||o?.name||''),[u,f]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[j,w]=(0,t.useState)(!1),[I,D]=(0,t.useState)(''),S=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${k(e.date)})`;return(0,y.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${S}`,testID:"krota-sheet",children:(0,y.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,y.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{f(t),x(s)}},e))}),(0,y.jsx)(n.T,{center:!0,children:"Start"}),(0,y.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:f,format:c.fmtH,label:"Start time"}),(0,y.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,y.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,y.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),I?(0,y.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.amber,children:I})}):null,(0,y.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?D(`${d} already has a shift that overlaps on ${S}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),r(`${e.shift?'Changed':'Added'}: ${d}, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!j?(0,y.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&j?(0,y.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",S,"?"]}),(0,y.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),r(`Removed ${d}'s shift on ${S}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,y.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1178,[35,403,103,795,892,961,1087,966,958,1076,859,1111,1067,822,26]); __d(function(g,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.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1179,[1166,955,35,380,103,795,892,966,868,822,1073,1158,1011,1180,26]); __d(function(g,_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.openLink=w,_e.useSheetReminders=C,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=C(),f=(0,b.wd)(l);return(0,j.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,j.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,j.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,j.jsx)($,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,j.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]);function w(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function k(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const S={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},T={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function C(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function $({s:e,open:n,onToggle:o}){const{rid:C,r:$,me:D,now:I}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),M=(0,u.useOrderSheets)(e=>e.markOpened),B=(0,u.useOrderSheets)(t=>t.opened[e.id]),[L,P]=(0,s.useState)({}),[O,R]=(0,s.useState)(''),[A,z]=(0,s.useState)(''),[_,W]=(0,s.useState)(!1),H=(0,h.useShellfish)(C,D,'chef'),K=(0,b.nextDelivery)(e,I),E=(0,b.orderLines)(e,L,O,C),N=($.address??$.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=N.length>=3?N[1]:N[0]??'',U=(0,b.orderMessage)(e,$.name,q,E,D.split(' ')[0],I),Q=e.orderDays.includes((0,b.wd)(I)),Y=(e,t)=>P(n=>({...n,[e.id]:(0,l.stepQuantity)(C,e,n[e.id]||0,t)})),F=t=>{M(e.id,I.toISOString()),w(t)},G='text'===e.method||'whatsapp'===e.method||'phone'===e.method,V=Math.round(100*((0,y.parseMoneyInput)(A)??NaN)),J=H.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),X=J.filter(e=>H.isLow(e.key));return(0,j.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:Q||X.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,j.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[S[e.method]," ",e.name]}),(0,j.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,j.jsx)(i.Muted,{children:e.goods}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,j.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,j.jsx)(i.Badge,{kind:Q?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,j.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,j.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,J.length?(0,j.jsx)(i.Badge,{kind:X.length?'amber':'ok',label:J.map(e=>`${e.icon} ${(0,c.fmtStockCount)(C,e,H.counts[e.key]??0)}`).join(' \xb7 ')}):null,B&&new Date(B).toDateString()===I.toDateString()?(0,j.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,j.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[K?(0,j.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(K),"."]}):null,e.reminder?(0,j.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,j.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,j.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,j.jsxs)(d.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{children:[e.name,e.unit?(0,j.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(C,e),")"]}):null]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Y(e,-1),style:{minWidth:44,minHeight:44}}),(0,j.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(C,e,L[e.id]||0),children:(0,j.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(C,e)?(0,l.fishQtyText)(C,e,L[e.id]||0):L[e.id]||0})}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Y(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,j.jsx)(t.TextInput,{value:O,onChangeText:R,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[T,{minHeight:60}]})]}),G?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(C,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,'online'===e.method?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(C,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,e.priceCapPerKg?(0,j.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,j.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,j.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,j.jsx)(t.TextInput,{testID:"price-found",value:A,onChangeText:e=>z((0,y.sanitiseMoneyTyping)(e)),keyboardType:"decimal-pad",inputMode:"decimal",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[T,{width:120}]})]}),V>0?(0,j.jsx)(i.Badge,{kind:V<=e.priceCapPerKg?'ok':'red',label:V<=e.priceCapPerKg?`${(0,p.gbp)(V)}/kg is under the cap \u2713`:`${(0,p.gbp)(V)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,j.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,j.jsx)(i.T,{size:f.font.small,children:E.length?U:'Add quantities above to write the order.'})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!E.length,onPress:()=>F((0,b.smsLink)(e.number,U))}):null,'whatsapp'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!E.length,onPress:()=>F((0,b.waLink)(e.number,U))}):null,'phone'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>F((0,b.telLink)(e.number))}):null,'online'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>F(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&E.length?(0,j.jsx)(i.Button,{kind:"ghost",label:_?'Copied \u2713':'Copy order',onPress:async()=>{const e=await k(U);W(e),e&&setTimeout(()=>W(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,j.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,j.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1180,[828,836,955,35,380,237,403,103,795,1009,954,956,868,1010,822,1158,14,26]); -__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); +__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',justifyContent:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},1182,[5,823,824,829,237,827]); __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,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',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,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',w:64,h:45}}},1183,[]); __d(function(g,_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(', '))})]})}},1184,[828,1009,1166,955,35,403,103,795,892,868,822,1158,1011,14,26]); @@ -1301,7 +1301,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.AssignRoleSheet=function({name:e,when:s,current:u,onSave:b,onEditTimes:y,onClose:j}){const x={minHeight:o.IS_CAR?64:56,width:'100%'},_=(0,l.cleanBadge)(u);return(0,c.jsxs)(n.Sheet,{visible:!0,onClose:j,title:"Assign a role?",testID:"assign-role-sheet",maxWidth:560,children:[(0,c.jsx)(n.T,{size:18,center:!0,weight:"semibold",children:e}),(0,c.jsx)(n.Muted,{center:!0,children:s}),(0,c.jsxs)(t.default,{style:{gap:8,width:'100%'},children:[l.ROLE_BADGES.map(e=>(0,c.jsx)(n.Button,{kind:_===e?'primary':'secondary',label:e,testID:`assign-role-${h(e)}`,accessibilityLabel:`${e}${_===e?', chosen':''}`,onPress:()=>b(e),style:x},e)),(0,c.jsx)(n.Button,{kind:_?'secondary':'primary',label:"None",testID:"assign-role-none",accessibilityLabel:_?'None, clear the role badge':'None, chosen',onPress:()=>b(void 0),style:x}),y?(0,c.jsx)(n.Button,{kind:"ghost",label:"Edit shift times",testID:"assign-role-edit-times",onPress:y,style:x}):null]})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),o=r(d[4]),c=r(d[5]);const h=e=>e.replace(/\s+/g,'-').toLowerCase()},1218,[35,103,795,1217,873,26]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1219,[35,103,795,892,822,1073,1076,1215,1087,26]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1220,[35,103,1073,822,795,26]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),f=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),u=(0,n.useOwner)(e=>e.staff),x=(0,o.workingNow)(f,u,t),w=(0,o.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:r.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:r.colours.muted,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:r.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:r.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:r.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:r.colours.muted,center:!0,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:r.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:r.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),h=_r(d[7])},1221,[35,103,1073,892,1222,822,795,26]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:t=!1,marquee:s=!1}={}){const{today:u}=(0,o.useCtx)(15e3),p=(0,l.useOwner)(e=>(0,l.liveAttendance)(e.attendance)),j=(0,l.useOwner)(e=>e.staff),I=(0,r.workingNow)(p,j,u),D=(0,r.cardSpeech)(I),[k,v]=(0,e.useState)(0),[L,S]=(0,e.useState)(0),[W,O]=(0,e.useState)(y);if((0,e.useEffect)(()=>{t&&s&&x()},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'function'!=typeof window.matchMedia)return;const e=window.matchMedia('(prefers-reduced-motion: reduce)'),n=()=>O(!!e.matches);return n(),e.addEventListener?e.addEventListener('change',n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener('change',n):e.removeListener(n)}},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'undefined'==typeof ResizeObserver)return;const e=document.querySelector('[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]');if(!e)return;const n=()=>{const t=e.querySelector('[data-testid="whos-on-shift-list"]');v(e.clientWidth),t&&S(Math.max(t.scrollWidth,t.offsetWidth))},o=new ResizeObserver(n);o.observe(e);const l=e.querySelector('[data-testid="whos-on-shift-list"]');return l&&o.observe(l),n(),()=>o.disconnect()},[t,s,I.length,D]),t&&s){const e=k>0&&L>k+1&&f&&!W,t=w.find(e=>e>=Math.round((L+48)/32))??80,s=0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,numberOfLines:1,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",children:(0,h.jsx)(b,{rows:I,testIds:!0})});return(0,h.jsxs)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:0,paddingHorizontal:10,height:44,maxHeight:44,minHeight:44,overflow:'hidden',width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',gap:8},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",numberOfLines:1,style:{flexShrink:0},children:r.CARD_TITLE}),(0,h.jsxs)(n.default,{testID:"whos-on-shift-marquee",onLayout:e=>v(e.nativeEvent.layout.width),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,height:44,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:[(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",onLayout:e=>S(e.nativeEvent.layout.width),style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row',flexWrap:'nowrap',flexShrink:0,width:'max-content'},children:(0,h.jsx)(b,{rows:I,testIds:!1})}),e?(0,h.jsxs)(n.default,{dataSet:{ccwho:`tick-${t}`},style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center'},children:[(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:s}),(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:(0,h.jsx)(b,{rows:I,testIds:!1})})]}):(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,width:'max-content'},children:s})]})]})}if(t)return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:d.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:18,colour:d.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:d.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:d.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]);const f='undefined'!=typeof document,w=[18,24,32,40,50,64,80],u=`\n[data-testid="display-whos-on-top"]{overflow:hidden;max-width:100%;width:100%}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"] *{flex-wrap:nowrap!important;white-space:nowrap}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"]{display:inline-flex!important;flex-direction:row;align-items:center;width:max-content!important;max-width:none!important}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]>[data-ccwho],[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;width:max-content}\n${w.map(e=>`[data-testid="display-whos-on-top"] [data-ccwho="tick-${e}"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;animation:ccwho-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccwho-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{animation:none!important}}\n`;let p=!1;function x(){if(!f||p)return;p=!0;const e=document.createElement('style');e.setAttribute('data-ccwho-css','1'),e.textContent=u,document.head.appendChild(e)}const y=()=>f&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;function b({rows:e,testIds:t}){return(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',columnGap:10,flexShrink:0,width:'max-content'},children:e.map(e=>(0,h.jsxs)(n.default,{testID:t?`whos-on-shift-${e.staffId}`:void 0,accessible:t,accessibilityLabel:t?e.speech:void 0,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,numberOfLines:1,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,numberOfLines:1,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})}},1221,[35,237,103,1073,892,1222,822,795,26]); __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1222,[]); __d(function(g,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.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1223,[828,1042,35,403,103,795,1012,822,901,26]); __d(function(g,_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.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1224,[828,797,1225,1143,836,892,35,337,403,103,795,1012,1013,822,896,901,1226,1229,1231,26]); @@ -1426,7 +1426,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}},1343,[828,861,35,103,795,862,868,1168,1344,875,822,26]); __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})},1344,[904,958,1168]); __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]})}},1345,[31,35,873,1346,1416,26]); -__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=e(_r(_d[40])),G=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]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ye.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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:l?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:l?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),s?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.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||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ye.jsx)(Q.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${s.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ye.jsx)(Q.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ye.jsx)(Q.T,{size:12,colour:se.colours.muted,children:l}):null]})}function at({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,s));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:l?16:18,weight:"bold",children:[it(e)," \xb7 ",lt(e.customerName)]}),(0,Ye.jsx)(Q.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,Ye.jsxs)(Q.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,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,le.useRestaurant)(jt);(0,Re.useAlertWatcher)(jt,{enabled:!e});const kt=(0,le.useOrders)(jt),It=(0,le.useBookings)(jt),Dt=(0,le.useEvents)(jt),vt=(0,le.useStore)(e=>e.skipMinutes),St=(0,le.useStore)(e=>e.clock.mode),Ct=(0,le.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Rt=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,Ne.workingShifts)(Rt,Bt),[Rt,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Wt=(0,$.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:lt(Tt.find(e=>e.id===Wt)?.name)}),Ht=I.IS_CAR?'Car':'Display';(0,L.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,ne.useFrontDoor)(Pt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Ft=(0,re.useFloor)(e=>e.live[jt]),Gt=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,el]=(0,H.useState)(null),[tl,ll]=(0,H.useState)(null),[sl,il]=(0,H.useState)(!1),[ol,nl]=(0,H.useState)(!1),[al,rl]=(0,H.useState)(null),[dl,cl]=(0,H.useState)(!1),[ul,hl]=(0,H.useState)(!1),[gl,bl]=(0,H.useState)(!1),[yl,pl]=(0,H.useState)(null),[fl,xl]=(0,H.useState)(null),[ml,jl]=(0,H.useState)(null),[wl,kl]=(0,H.useState)(!1),Il=P.default.useRef(0),Dl=e=>{Il.current=Date.now(),jl(e)};P.default.useEffect(()=>{if(!ml)return;const e=setInterval(()=>{Date.now()-Il.current>=He.DAY_IDLE_MS&&jl(null)},5e3);return()=>clearInterval(e)},[ml]);const vl=(0,le.useWaitlist)(jt),Sl=(0,le.useStore)(e=>e.walkIns[jt]??0),[Cl,Tl]=(0,H.useState)(!1),[$l,Rl]=(0,H.useState)(!1),[Bl,Ll]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Wl,zl]=(0,H.useState)({view:0,content:0}),[Hl,Pl]=(0,H.useState)(null);P.default.useEffect(()=>{Hl&&((0,W.notify)({id:`floor-note:${Date.now()}`,title:Hl,timeoutMs:4500,big:!0,testID:'floor-toast'}),Pl(null))},[Hl]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Ml,Al]=(0,H.useState)(null),El=P.default.useRef(0),[Ol,Nl]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ml)return;El.current=Date.now();const e=setInterval(()=>{const e=Date.now()-El.current;if(e>=Xe)return Al(null),void Pl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nl(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ml]);const _l=e=>e.date!==Pt?ll({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!ci.ok,accessibilityHint:ci.hint,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ll({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ll(null),Pl(e)}}):null,e.walkIn?(0,Ye.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ll(null),Pl(e)}}):null,(0,Se.bookingDetails)(e)]})}),Fl=It.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),Gl=Fl.filter(e=>!['cancelled','noshow'].includes(e.status)),Vl=kt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ul=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),Kl=(0,Be.closedAreasAt)(Gt,jt,Pt,(0,te.hm)(Ct)),ql=[...Kl].join(','),Yl=(0,H.useMemo)(()=>(0,de.floorView)(_t,It,kt,Ft??{},Ct,wt.settings.turnMins,Kl),[_t,It,kt,Ft,Ct.getTime(),ql]),Ql=(0,ve.hoursFor)(wt,Ct),Jl=Ql?.open??new Date(`${Pt}T12:00:00`),Xl=Ql?.close??new Date(`${Pt}T21:00:00`),Zl=(0,te.addMins)(Jl,-Jl.getMinutes()),es=(0,te.addMins)(Xl,30),ts=e=>new Date(`${Pt}T${e}:00`),ls=(0,Be.blocksOn)(Gt,jt,Pt).map(e=>({from:ts(e.from),to:ts(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Pt)),ss=Object.keys(Yl).filter(e=>'blocked'===Yl[e]?.status),is=ml&&ml!==Pt?ml:Pt,os=is!==Pt,ns=(0,He.dayWord)(is,Pt),as=/^(Today|Yesterday|Tomorrow)$/.test(ns),rs=os?(0,He.bookingsForDay)(It,is,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Fl,ds=(0,te.parseYmd)(is);ds.setHours(12);const cs=os?(0,ve.hoursFor)(wt,ds):Ql,us=cs?.open??new Date(`${is}T12:00:00`),hs=cs?.close??new Date(`${is}T21:00:00`),gs=e=>new Date(`${is}T${e}:00`),bs=[...os?(0,Be.blocksOn)(Gt,jt,is).map(e=>({from:gs(e.from),to:gs(e.to),label:e.reason??'Paused'})):ls,...os?(0,o.queuedServicePauses)(wt,ds,is):[]],ys=(0,o.queuedServiceSessions)(wt,ds),ps=s.IS_QUEUED_VENUE&&(void 0===ys||!ys.length),fs=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ys?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),xs=os?cs||rs.length?isos?(0,de.dayFloorView)(_t,rs,is):Yl,[os,_t,rs,is,Yl]),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),[Ss,Cs]=(0,H.useState)(null),Ts=os?rs.filter(e=>!['cancelled','noshow'].includes(e.status)):Gl,$s=Ts.reduce((e,t)=>e+t.partySize,0),Rs=(0,u.coversSplit)(Ts,is),Bs=(0,Me.cancelledDayTally)(It,is),Ls=(0,Ae.cancellationsFor)(It,is,e=>e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Ws=(0,Me.cancelledTallyWords)(Bs,as?ns.toLowerCase():os?`on ${ns}`:'today'),zs=Gt.filter(e=>e.rid===jt&&e.date===is&&!e.removedAt),Hs=(0,ze.chartBands)(zs,60*us.getHours()+us.getMinutes(),60*hs.getHours()+hs.getMinutes()),Ps=new Set((0,ze.blockedHours)(Hs)),Ms=Ct.getHours()+(Ct.getMinutes()>=30?1:0),As=Ul.hours.filter(e=>e.hour>=Ms&&!Ps.has(e.hour)),Es=As.reduce((e,t)=>e+t.coversHigh,0),Os=As.reduce((e,t)=>e+t.coversLow,0),Ns=Math.round((Os+Es)/2),_s=!Ul.example&&Ul.open&&Ul.enough&&Es>0?`Usually ${(0,c.coversRange)(Ns,Ns)} more`:void 0,Fs=async(e,t)=>{const l=Yl[e]?.booking;if(!l||e===t)return;const s=Yl[t]?.status;if(s&&!['free','soon'].includes(s))return void Pl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Pl,{b:l,tables:[t]}))return;await le.repo.bookings.update(l.id,{table:t});const i=Ft?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Pl(`Saving: ${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(l.id,`${(0,xe.privName)(l,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}`,Pl)},Gs=e=>{if(fl)return Is(null),void xl(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);os?ws(e):Zt?(e!==Zt&&Fs(Zt,e),el(null)):Xt(e)},Vs=fl?It.find(e=>e.id===fl.id):void 0,Us=fl&&Vs?(()=>{const e=Vs.walkIn?(0,xe.privName)(Vs,Ot):lt(Vs.name),t=(0,De.seatsOf)(_t,fl.tables).total,l=(0,De.seatLine)(t,Vs.partySize),s=(0,De.pickClashes)(Vs,fl.tables,It.filter(e=>e.date===Vs.date),wt.settings.turnMins),i=(0,De.tableKey)(fl.tables)!==(0,De.tableKey)((0,re.tablesOf)(Vs.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(Vs.date,Pt)} ${Vs.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(fl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(Vs.date,Pt)," ",Vs.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:se.colours.text,children:[(0,De.tablesWords)(fl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ks?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ks,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ks})}):null,Ds&&Vs&&fl.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,fl.tables.join('+')),onYes:()=>{vs(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,l,e,t,Pl)})()},onNo:()=>vs(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:ks?'plan-pick-overcap-yes':'plan-pick-save',label:ks?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ks?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(fl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Vs)return void xl(null);if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=(0,De.overCapacityAsk)(fl.tables,t,Vs.partySize);if(l&&!ks)return void Is(l);if('finished'===Vs.status&&fl.tables.length&&!Ds)return void vs(!0);Is(null),vs(!1);const s=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,s,e,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Is(null),xl(null)}})]})]})})():null,Ks=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),qs=e=>{const t=_t.tables.filter(t=>t.areaId===e);return os?`${t.filter(e=>!ms[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Yl[e.name]?.status??'free')).length}/${t.length} free`},Ys='all'===Yt||Ks.some(e=>e.id===Yt)?Yt:'all',Qs=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:ms,privacy:Ot,turnBase:wt.settings.turnMins,highlight:fl?fl.tables:Zt?[Zt]:void 0,onTap:e=>Gs(e.name),onDrop:(e,t)=>fl||os?void 0:Fs(e.name,t.name)}),Js=ut?1:ht||Ks.length>2?2:1,Xs=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=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)/l},Zs=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ti=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:qs(e.id)})]}),li=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(l-xt.h)>1)&&mt({w:t,h:l})},children:ei?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:ei.scroll,showsVerticalScrollIndicator:ei.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:ei.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:ei.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=Ks.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ei.cellW,gap:2},children:[ti(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:Qs(e)})]},e)})},t))}):null}),si=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Ys,onPress:()=>Qt('all')},"__all"),...Ks.map(e=>(0,Ye.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ut?Kl.has(e.id)?'closed':Ys===e.id?qs(e.id):void 0:void 0,selected:Ys===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;zl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>zl(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:Wl.view>0&&Wl.content>0&&Wl.content<=Wl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Wl.view>0&&Wl.content<=Wl.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),Us,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>el(null)})]}):null,'all'===Ys&>?li:'all'===Ys?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:Zs.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>Xs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:qs(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:qs(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*Xs(e.id)))}:{flex:1},children:Qs(e.id)})]},e.id)),e.length{if(os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},is)}),oi='timeline'===Vt,ni=Kt?(0,Ye.jsx)(F.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${os?(0,He.dayLong)(is):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),ps?fs:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:os?rs:Fl,now:os?us:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:os?(0,te.addMins)(us,-us.getMinutes()):Zl,t1:os?(0,te.addMins)(hs,30):es,pauses:os?bs:ls,blockedTables:os?[]:ss,onOpen:e=>{if(qt(!1),os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},`full-${is}`)})]})}):null,ai=os?(0,Ye.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:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:as?`Showing ${ns} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(is))}`:`Showing ${(0,He.dayWord)(is,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ws}. Showing ${(0,He.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{xl(null),Dl(null)},style:{minHeight:44}})]}):null,ri=(0,Ye.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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(oi||Kt);return(0,Ye.jsx)(V.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.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,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),di='display'===I.APP_VARIANT&&!e?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ri,(0,Ye.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:Rt,staff:Tt,today:Pt,leave:Bt})]}):ri,ci=(0,h.useBookingWrite)(),ui=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>nl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint})]});(0,qe.useDisplayNotices)(jt,!e);const hi=ut?180:168,[gi,bi]=(0,H.useState)(hi),yi=P.default.useRef(hi),pi=P.default.useRef(null),fi=P.default.useRef(null),xi=()=>{const e=pi.current,t=fi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=ct<820?8:12,o=44+(ct<820?4:8),n=i>yi.current?Math.ceil(i-yi.current):We.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(hi,Math.floor(t-s-l)-n-o));Math.abs(yi.current-a)>=2&&(yi.current=a,bi(a))})})};P.default.useEffect(()=>{const e=setTimeout(xi,60);return()=>clearTimeout(e)},[rt,ct]);const mi=(0,Ye.jsxs)(K.default,{ref:fi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),xi()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Nl(null),Al({at:Date.now()})},onHint:()=>Pl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(Le.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:is}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(Le.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ll(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),ji=Vl.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:se.colours.muted,children:[Vl.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Vl,me:zt,compact:!0,bookings:It})})]}):null,wi=(Oe.DueToday,wt.settings.turnMins||90),ki=os?rs:(0,v.todaysGuestList)(Fl,Ct,wi),Ii=os?[]:(0,v.todaysFinishedList)(Fl,Ct,wi),Di=os?as?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',vi=(0,Ye.jsxs)(Ye.Fragment,{children:[0===ki.length?(0,Ye.jsx)(Q.Muted,{children:os?is{const t=(0,v.isLeftEarly)(e,Ct,wi),l=(0,ie.isSeatedHighlight)(e.status,{otherDay:os})&&!t,s=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=se.colours.text,o=l?se.colours.goldLight:se.colours.muted,n=se.colours.gold,a=s.depositWarn?se.colours.amber:se.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:os?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(_.AllergyIcon,{text:s.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,s.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ii.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ii.length}${gl?', expanded':', collapsed'}`,accessibilityState:{expanded:gl},onPress:()=>bl(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ii.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:se.colours.muted,children:gl?'\u25be':'\u25b8'})]}),gl?Ii.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:ci.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Ee.CancellationsSection,{items:Ls,dayWord:os?as?ns.toLowerCase():`on ${ns}`:'today'})]}),Si=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:vi}),Ci=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&hl(!1)}}),Ti=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Di}, ${ki.length}`,accessibilityState:{expanded:ul},'aria-expanded':ul,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:ul?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:ul?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:se.colours.gold,children:ki.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Di," ",ul?'\u2039':'\u203a']})})})]}),$i=ul?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...Ci.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Di.toUpperCase()," (",ki.length,")"]}),(0,Ye.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Di}`,onPress:()=>hl(!1),style:{marginRight:-6}})]}),Bs.count?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Ws}):null]}),Si]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Di}`,accessibilityRole:"button",onPress:()=>hl(!1),style:{flex:1}})]}):null,Ri=ps?fs:s.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:rs,open:us,close:hs,now:Ct,turnBase:wt.settings.turnMins,blocks:zs,pauses:bs,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:hi,forecastNote:os?void 0:_s,emptyText:xs,past:is{Il.current=Date.now(),kl(!0)},shortDay:!ut&&rt<1100}),Wi=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:wl,today:Pt,day:is,bookings:It,restaurant:wt,now:Ct,onDay:Dl,onClose:()=>kl(!1)}),zi=()=>{os?hl(!0):qt(!0)},Hi=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ct<820?8:12,paddingTop:ct<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[Mt?null:Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:ai,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):oi?ii:si,ni,$i]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ui(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:di}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:ct<820,snug:ct<820,tight:ct<700,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{ref:pi,testID:"day-graph-slot",onLayout:xi,style:{flexGrow:0,flexShrink:1,flexBasis:hi+52,minHeight:ct<=600?90:120,overflow:'visible'},children:Bi}),(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),ji,(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Il.current=Date.now()},onMouseDown:()=>{Il.current=Date.now()},children:[ut?(0,Ye.jsxs)(K.default,{style:{flex:1},children:[(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt}),Li,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(ot,{phone:!0,split:Rs,items:[{label:`Tables \xb7 ${ns}`,value:Ts.length,testID:'badge-tables'},{label:`Covers \xb7 ${ns}`,value:$s,testID:'badge-covers'},{label:'Takeaway',value:Vl.length,alert:Vl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>il(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ui(!0)}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),di,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[oi?ii:si,ni]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Di," (",ki.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{gap:4},children:vi})]}),ji,Bi,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),mi]}),e?null:(0,Ye.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:se.colours.hairline},children:(0,Ye.jsx)(N.VoiceSlot,{size:56})})]}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ct<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ye.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Li}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,Ye.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.muted,children:"?"})}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,e?null:(0,Ye.jsx)(j.ExitButton,{}),ee,Ue?null:(0,Ye.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,!I.IS_CAR&&Mt?(0,Ye.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(ot,{splitOnly:!0,split:Rs,items:[]})})]})}),gt?Hi:(Pi=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ui(!1)}),di]}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[ai,oi?ii:si,ni,$i]})]})}),ji,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:hi+We.DAY_GRAPH_CHROME},children:Bi})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Pi})),mi]}),(0,Ye.jsx)(R.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ll(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Bl,onClose:()=>Ll(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ol?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>nl(!1)}):null,al?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:al,who:zt,onClose:()=>rl(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Yl,plan:_t,todays:Fl,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>el(e),onDetails:_l}):null,js?(()=>{const e=ms[js],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Cs(null),ws(null)},title:`${(0,d.tableNumbersA11y)(js)} \xb7 ${as?ns:(0,He.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${as?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${as?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Ot):lt(e.name);return(0,Ye.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ws(null),pl(e.id)},style:{minHeight:56}},e.id)}),is>=Pt?(()=>{const t=e?.table.maxSeats??0,l=It.filter(e=>e.date===is&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(js)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(js)]}),Ss?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Ss.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Ss.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ci.ok,accessibilityHint:ci.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Ss.id);if(Cs(null),!e)return;const l=lt(e.name);ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Cs(null)})]})]}):null,Ss?null:l.slice(0,12).map(e=>{const l=lt(e.name),s=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ci.ok,accessibilityHint:ci.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(js)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:e,tables:[js]}))return;const s=(0,De.overCapacityAsk)([js],t,e.partySize);s?Cs({id:e.id,ask:s}):(ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Cs(null),ws(null)},style:{minHeight:56}})]})})():null,yl?(()=>{const e=It.find(e=>e.id===yl);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Ot):lt(e.name),view:Yl,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>pl(null),onDetails:_l,onDone:Pl,onEdit:e=>{pl(null),rl(e.id)},onPickOnPlan:(e,t)=>{hl(!1),Ut('plan'),Qt('all'),xl({id:e.id,tables:t})}}):null})():null,tl?(0,Ye.jsx)(Se.DetailsPanel,{title:tl.title,onClose:()=>ll(null),children:tl.body}):null,Wi,dl?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Fl,orders:kt,waitlistAll:vl,walkInCount:Sl,onClose:()=>cl(!1)}):null,Cl?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Tl(!1)})]}):null,$l?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Rl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Rl(!1)})]}):null,sl?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>il(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Vl,me:zt,bookings:It})]}):null,Ml?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{El.current=Date.now(),null!==Ol&&Nl(null)},notice:null!==Ol?`Locking again in ${Ol} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Al(null),Pl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Pl('Live seating plan updated on every screen.')},onCancel:()=>{Al(null),Pl('No changes kept. Editing is locked again.')}},Ml.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)($e.TakeawayTakeover,{rid:jt,me:zt})]});var Pi}function dt({rid:e,id:t,turnBase:l}){const s=(0,le.useBookings)(e).find(e=>e.id===t);return s?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); +__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,qe.jsx)(rt,{...e}):(0,qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Q.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]),o=_r(_d[4]),n=_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]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_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]),H=_r(_d[32]),z=_r(_d[33]),M=e(z),P=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_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])),Y=e(_r(_d[45])),q=_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]),oe=_r(_d[56]),ne=_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]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_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]),He=_r(_d[85]),ze=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_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]),Ye=_r(_d[99]),qe=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?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)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,qe.jsx)(Q.T,{size:s?14:12,colour:le.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)(M.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||o?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)(Q.T,{size:14,colour:le.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)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Q.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:le.colours.gold},children:[(0,qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){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:n?4:7,minHeight:44,paddingHorizontal:n?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:[o?(0,qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,qe.jsx)(Q.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.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:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,qe.jsx)(Q.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)(Q.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)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,Y.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=M.default.useRef(null),xt=M.default.useRef(0),[ft,mt]=(0,z.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const kt=(0,se.useOrders)(jt),It=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),Rt=(0,oe.useOwner)(e=>e.attendance),$t=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Wt=M.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);M.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Mt=(0,te.ymd)(Ct),Pt=(0,A.useTravelDay)('display',Mt),At=(0,ne.useFrontDoor)(Mt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,xe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,z.useState)('plan'),[Kt,Yt]=(0,z.useState)(!1),[qt,Qt]=(0,z.useState)('all'),[Jt,Xt]=(0,z.useState)(null),[Zt,es]=(0,z.useState)(null),[ts,ss]=(0,z.useState)(null),[ls,is]=(0,z.useState)(!1),[os,ns]=(0,z.useState)(!1),[as,rs]=(0,z.useState)(null),[ds,cs]=(0,z.useState)(!1),[us,hs]=(0,z.useState)(!1),[gs,bs]=(0,z.useState)(!1),[ys,ps]=(0,z.useState)(null),[xs,fs]=(0,z.useState)(null),[ms,js]=(0,z.useState)(null),[ws,ks]=(0,z.useState)(!1),Is=M.default.useRef(0),Ds=e=>{Is.current=Date.now(),js(e)};M.default.useEffect(()=>{if(!ms)return;const e=setInterval(()=>{Date.now()-Is.current>=ze.DAY_IDLE_MS&&js(null)},5e3);return()=>clearInterval(e)},[ms]);const vs=(0,se.useWaitlist)(jt),Ss=(0,se.useStore)(e=>e.walkIns[jt]??0),[Cs,Ts]=(0,z.useState)(!1),[Rs,$s]=(0,z.useState)(!1),[Bs,Ws]=(0,z.useState)(!1),[Ls,Hs]=(0,z.useState)(!1);(0,X.useReviewAlerts)(jt);const[zs,Ms]=(0,z.useState)({view:0,content:0}),[Ps,As]=(0,z.useState)(null);M.default.useEffect(()=>{Ps&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Ps,timeoutMs:4500,big:!0,testID:'floor-toast'}),As(null))},[Ps]),M.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Es,Os]=(0,z.useState)(null),Ns=M.default.useRef(0),[_s,Gs]=(0,z.useState)(null);M.default.useEffect(()=>{if(!Es)return;Ns.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Ns.current;if(e>=Xe)return Os(null),void As('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Gs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Fs=e=>e.date!==Mt?ss({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Mt)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!hi.ok,accessibilityHint:hi.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),As(e)}}):null,e.walkIn?(0,qe.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Mt,onDone:e=>{ss(null),As(e)}}):null,(0,Se.bookingDetails)(e)]})}),Vs=It.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Us=Vs.filter(e=>!['cancelled','noshow'].includes(e.status)),Ks=kt.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,z.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),qs=(0,Be.closedAreasAt)(Ft,jt,Mt,(0,te.hm)(Ct)),Qs=[...qs].join(','),Js=(0,z.useMemo)(()=>(0,de.floorView)(_t,It,kt,Gt??{},Ct,wt.settings.turnMins,qs),[_t,It,kt,Gt,Ct.getTime(),Qs]),Xs=(0,ve.hoursFor)(wt,Ct),Zs=Xs?.open??new Date(`${Mt}T12:00:00`),el=Xs?.close??new Date(`${Mt}T21:00:00`),tl=(0,te.addMins)(Zs,-Zs.getMinutes()),sl=(0,te.addMins)(el,30),ll=e=>new Date(`${Mt}T${e}:00`),il=(0,Be.blocksOn)(Ft,jt,Mt).map(e=>({from:ll(e.from),to:ll(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Mt)),ol=Object.keys(Js).filter(e=>'blocked'===Js[e]?.status),nl=ms&&ms!==Mt?ms:Mt,al=nl!==Mt,rl=(0,ze.dayWord)(nl,Mt),dl=/^(Today|Yesterday|Tomorrow)$/.test(rl),cl=al?(0,ze.bookingsForDay)(It,nl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):Vs,ul=(0,te.parseYmd)(nl);ul.setHours(12);const hl=al?(0,ve.hoursFor)(wt,ul):Xs,gl=hl?.open??new Date(`${nl}T12:00:00`),bl=hl?.close??new Date(`${nl}T21:00:00`),yl=e=>new Date(`${nl}T${e}:00`),pl=[...al?(0,Be.blocksOn)(Ft,jt,nl).map(e=>({from:yl(e.from),to:yl(e.to),label:e.reason??'Paused'})):il,...al?(0,o.queuedServicePauses)(wt,ul,nl):[]],xl=(0,o.queuedServiceSessions)(wt,ul),fl=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),ml=(0,qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),jl=al?hl||cl.length?nlal?(0,de.dayFloorView)(_t,cl,nl):Js,[al,_t,cl,nl,Js]),[kl,Il]=(0,z.useState)(null),[Dl,vl]=(0,z.useState)(null),[Sl,Cl]=(0,z.useState)(!1),[Tl,Rl]=(0,z.useState)(null),$l=al?cl.filter(e=>!['cancelled','noshow'].includes(e.status)):Us,Bl=$l.reduce((e,t)=>e+t.partySize,0),Wl=(0,u.coversSplit)($l,nl),Ll=(0,Pe.cancelledDayTally)(It,nl),Hl=(0,Ae.cancellationsFor)(It,nl,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),zl=(0,Pe.cancelledTallyWords)(Ll,dl?rl.toLowerCase():al?`on ${rl}`:'today'),Ml=Ft.filter(e=>e.rid===jt&&e.date===nl&&!e.removedAt),Pl=(0,He.chartBands)(Ml,60*gl.getHours()+gl.getMinutes(),60*bl.getHours()+bl.getMinutes()),Al=new Set((0,He.blockedHours)(Pl)),El=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Ol=Ys.hours.filter(e=>e.hour>=El&&!Al.has(e.hour)),Nl=Ol.reduce((e,t)=>e+t.coversHigh,0),_l=Ol.reduce((e,t)=>e+t.coversLow,0),Gl=Math.round((_l+Nl)/2),Fl=!Ys.example&&Ys.open&&Ys.enough&&Nl>0?`Usually ${(0,c.coversRange)(Gl,Gl)} more`:void 0,Vl=async(e,t)=>{const s=Js[e]?.booking;if(!s||e===t)return;const l=Js[t]?.status;if(l&&!['free','soon'].includes(l))return void As('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(As,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),As(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,As)},Ul=e=>{if(xs)return vl(null),void fs(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);al?Il(e):Zt?(e!==Zt&&Vl(Zt,e),es(null)):Xt(e)},Kl=xs?It.find(e=>e.id===xs.id):void 0,Yl=xs&&Kl?(()=>{const e=Kl.walkIn?(0,fe.privName)(Kl,Ot):st(Kl.name),t=(0,De.seatsOf)(_t,xs.tables).total,s=(0,De.seatLine)(t,Kl.partySize),l=(0,De.pickClashes)(Kl,xs.tables,It.filter(e=>e.date===Kl.date),wt.settings.turnMins),i=(0,De.tableKey)(xs.tables)!==(0,De.tableKey)((0,re.tablesOf)(Kl.table));return(0,qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Kl.date,Mt)} ${Kl.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Kl.date,Mt)," ",Kl.time]}),(0,qe.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Dl?(0,qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Dl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,qe.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Dl})}):null,Sl&&Kl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Cl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,s,e,t,As)})()},onNo:()=>Cl(!1)}):null,(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:Dl?'plan-pick-overcap-yes':'plan-pick-save',label:Dl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Dl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Kl)return void fs(null);if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=(0,De.overCapacityAsk)(xs.tables,t,Kl.partySize);if(s&&!Dl)return void vl(s);if('finished'===Kl.status&&xs.tables.length&&!Sl)return void Cl(!0);vl(null),Cl(!1);const l=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,l,e,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),fs(null)}})]})]})})():null,ql=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),Ql=e=>{const t=_t.tables.filter(t=>t.areaId===e);return al?`${t.filter(e=>!wl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Js[e.name]?.status??'free')).length}/${t.length} free`},Jl='all'===qt||ql.some(e=>e.id===qt)?qt:'all',Xl=e=>(0,qe.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:wl,privacy:Ot,turnBase:wt.settings.turnMins,highlight:xs?xs.tables:Zt?[Zt]:void 0,onTap:e=>Ul(e.name),onDrop:(e,t)=>xs||al?void 0:Vl(e.name,t.name)}),Zl=ut?1:ht||ql.length>2?2:1,ei=e=>{const t=_t.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},ti=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),ft.w,ft.h):null,li=e=>(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:Ql(e.id)})]}),ii=(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-ft.w)>1||Math.abs(s-ft.h)>1)&&mt({w:t,h:s})},children:si?(0,qe.jsx)(U.default,{style:{flex:1},scrollEnabled:si.scroll,showsVerticalScrollIndicator:si.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:si.rows.map((e,t)=>(0,qe.jsx)(K.default,{style:{height:si.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=ql.find(t=>t.id===e);return(0,qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:si.cellW,gap:2},children:[li(t),(0,qe.jsx)(K.default,{style:{flex:1},children:Xl(e)})]},e)})},t))}):null}),oi=(0,qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:_t}),_t.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)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Q.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)(Q.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)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Jl,onPress:()=>Qt('all')},"__all"),...ql.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?qs.has(e.id)?'closed':Jl===e.id?Ql(e.id):void 0:void 0,selected:Jl===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(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;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(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:zs.view>0&&zs.content>0&&zs.content<=zs.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:zs.view>0&&zs.content<=zs.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),Yl,Zt?(0,qe.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,qe.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===Jl&>?ii:'all'===Jl?(0,qe.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ti.map((e,t)=>(0,qe.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ei(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{center:!0,children:Ql(e.id)})]}):(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{children:Ql(e.id)})]}),(0,qe.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ei(e.id)))}:{flex:1},children:Xl(e.id)})]},e.id)),e.length{if(al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},nl)}),ai='timeline'===Vt,ri=Kt?(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:le.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:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.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)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${al?(0,ze.dayLong)(nl):'Today'}`})}),rt<600?null:(0,qe.jsx)(K.default,{style:{minWidth:180}})]}),fl?ml:(0,qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:al?cl:Vs,now:al?gl:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:al?(0,te.addMins)(gl,-gl.getMinutes()):tl,t1:al?(0,te.addMins)(bl,30):sl,pauses:al?pl:il,blockedTables:al?[]:ol,onOpen:e=>{if(Yt(!1),al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},`full-${nl}`)})]})}):null,di=al?(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:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:dl?`Showing ${rl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(nl))}`:`Showing ${(0,ze.dayWord)(nl,Mt)}`}),(0,qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${zl}. Showing ${(0,ze.dayLong)(nl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{fs(null),Ds(null)},style:{minHeight:44}})]}):null,ci=(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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(ai||Kt);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?(Ut('plan'),Yt(!0)):(Yt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.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)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ui='display'===I.APP_VARIANT&&!e?(0,qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ci,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:$t,staff:Tt,today:Mt,leave:Bt})]}):ci,hi=(0,h.useBookingWrite)(),gi=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint})]});(0,Ye.useDisplayNotices)(jt,!e);const bi=!e&&!I.IS_CAR&&!ut,yi=ut?180:202,[pi,xi]=(0,z.useState)(ut?180:168),fi=M.default.useRef(ut?180:168),mi=M.default.useRef(null),ji=M.default.useRef(null),wi=M.default.useRef(null),ki=!ut&&ct<=800,Ii=()=>{const e=mi.current,t=ji.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l)=>{const i=t>fi.current?Math.ceil(t-fi.current):0,o=Math.max(Le.DAY_GRAPH_CHROME+(ki?24:8),i),n=!ut&&ct>=700?140:70,a=Math.floor(s-4-e)-o-l,r=Math.min(yi,a>=n?Math.max(n,a):Math.max(0,a));Math.abs(fi.current-r)>=2&&(fi.current=r,xi(r))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,o,n,a)=>{t.measureInWindow((e,t)=>{const n=wi.current;bi&&n?.measureInWindow?n.measureInWindow((e,l,n,r)=>{const d=ct<820?4:8;s(o,a,t,Math.max(i,44+d+Math.round(r||0)))}):s(o,a,t,bi?i:l)})})};M.default.useEffect(()=>{const e=setTimeout(Ii,60);return()=>clearTimeout(e)},[rt,ct]);const Di=(0,qe.jsxs)(K.default,{ref:ji,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ii()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:ki?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ke.DisplayClockButton,{}),(0,qe.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Gs(null),Os({at:Date.now()})},onHint:()=>As('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:Ht,quiet:!0,display:!0,day:nl}),_t.areas.some(e=>e.outdoor)?(0,qe.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,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:()=>Hs(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(x.GiftQrButton,{rid:jt,venue:wt.name})]}),vi=Ks.length?(0,qe.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ks.length," live"]})]}),(0,qe.jsx)(K.default,{style:{padding:10},children:(0,qe.jsx)(at,{list:Ks,me:Ht,compact:!0,bookings:It})})]}):null,Si=(Oe.DueToday,wt.settings.turnMins||90),Ci=al?cl:(0,v.todaysGuestList)(Vs,Ct,Si),Ti=al?[]:(0,v.todaysFinishedList)(Vs,Ct,Si),Ri=al?dl?`${rl}\u2019s guests`:`Guests ${rl}`:'Today\u2019s guests',$i=(0,qe.jsxs)(qe.Fragment,{children:[0===Ci.length?(0,qe.jsx)(Q.Muted,{children:al?nl{const t=(0,v.isLeftEarly)(e,Ct,Si),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:al})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,o=s?le.colours.goldLight:le.colours.muted,n=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:al?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:l.time}),(0,qe.jsx)(Q.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)(_.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,qe.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?o:i,children:l.table}),l.dog?(0,qe.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ti.length?(0,qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ti.length}${gs?', expanded':', collapsed'}`,accessibilityState:{expanded:gs},onPress:()=>bs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",Ti.length,")"]}),(0,qe.jsx)(Q.T,{size:16,colour:le.colours.muted,children:gs?'\u25be':'\u25b8'})]}),gs?Ti.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(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:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Q.T,{size:15,colour:le.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:jt,today:Mt,who:t.name,allowed:hi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ee.CancellationsSection,{items:Hl,dayWord:al?dl?rl.toLowerCase():`on ${rl}`:'today'})]}),Bi=(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:$i}),Wi=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&&hs(!1)}}),Li=(0,qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ri}, ${Ci.length}`,accessibilityState:{expanded:us},'aria-expanded':us,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:Ci.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)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[Ri," ",us?'\u2039':'\u203a']})})})]}),Hi=us?(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",...Wi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.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,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Ri.toUpperCase()," (",Ci.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Ri}`,onPress:()=>hs(!1),style:{marginRight:-6}})]}),Ll.count?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:zl}):null]}),Bi]}),(0,qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ri}`,accessibilityRole:"button",onPress:()=>hs(!1),style:{flex:1}})]}):null,zi=fl?ml:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:cl,open:gl,close:bl,now:Ct,turnBase:wt.settings.turnMins,blocks:Ml,pauses:pl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?pi:yi,forecastNote:al?void 0:Fl,emptyText:jl,past:nl{Is.current=Date.now(),ks(!0)},shortDay:!ut&&rt<1100}),Ai=(0,qe.jsx)(Me.DisplayCalendar,{visible:ws,today:Mt,day:nl,bookings:It,restaurant:wt,now:Ct,onDay:Ds,onClose:()=>ks(!1)}),Ei=()=>{al?hs(!0):Yt(!0)},Oi=(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ki?4:ct<820?8:12,paddingTop:ki?bi?2:4:ct<820?bi?4:6:bi?8:10,gap:ki?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:di,Pt?(0,qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,today:Mt,app:"display"})}):ai?ni:oi,ri,Hi]}),(0,qe.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:gi(!1)}),(0,qe.jsx)(K.default,{style:{flexShrink:0},children:ui}),Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:ct<820,snug:ct<820,tight:ct<800,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{ref:mi,testID:"day-graph-slot",onLayout:Ii,style:{flexGrow:0,flexShrink:1,flexBasis:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),height:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),minHeight:ct<=600?90:Math.min((ut?yi:pi)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:Mi}),(0,qe.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[bi?null:(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),vi,(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht})]}),bi&&!Pt?(0,qe.jsx)(K.default,{ref:wi,testID:"display-side-split",style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})}):null]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{Is.current=Date.now()},onMouseDown:()=>{Is.current=Date.now()},children:[ut?(0,qe.jsxs)(K.default,{style:{flex:1},children:[(0,qe.jsxs)(U.default,{ref:pt,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)(Z.RestaurantLogo,{rid:jt,size:64}),(0,qe.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,qe.jsx)(Z.PoweredBy,{}),(0,qe.jsx)(H.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,qe.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:"m"}),(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt}),Pi,(0,qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(ot,{phone:!0,split:Wl,items:[{label:`Tables \xb7 ${rl}`,value:$l.length,testID:'badge-tables'},{label:`Covers \xb7 ${rl}`,value:Bl,testID:'badge-covers'},{label:'Takeaway',value:Ks.length,alert:Ks.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:gi(!0)}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),ui,(0,qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ai?ni:oi,ri]}),(0,qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[Ri," (",Ci.length,")"]}),(0,qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{gap:4},children:$i})]}),vi,Mi,(0,qe.jsx)(K.default,{testID:"covers-dock",children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.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)(Q.T,{center:!0,size:14,colour:Ot?le.colours.muted:le.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,qe.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Di]}),e?null:(0,qe.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:le.colours.hairline},children:(0,qe.jsx)(N.VoiceSlot,{size:56})})]}):(0,qe.jsxs)(qe.Fragment,{children:[bi?(0,qe.jsxs)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,n.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.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})}),(0,qe.jsx)(V.default,{testID:"display-more",accessibilityRole:"button",accessibilityLabel:"More",onPress:()=>Ws(!0),style:({pressed:e})=>({minWidth:44,height:44,marginLeft:8,paddingHorizontal:10,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center',flexShrink:0}),children:(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.muted,children:"More"})})]}):null,(0,qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ki?2:ct<820?4:8,gap:8,minHeight:ki&&bi?44:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,qe.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Pt?(0,qe.jsx)(K.default,{style:{width:220}}):(0,qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Pi}),(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:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Pt?null:(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,qe.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.muted,children:"?"})}),'simulated'===St?(0,qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,e?null:(0,qe.jsx)(j.ExitButton,{}),ee,Ue?null:(0,qe.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,I.IS_CAR||!Pt||bi?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Pt||bi?null:(0,qe.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,qe.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(K.default,{style:tt,children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})})]})}),gt?Oi:(Ni=(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:gi(!1)}),ui]}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),Pt?(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,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:[Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[di,ai?ni:oi,ri,Hi]})]})}),vi,Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:yi+Le.DAY_GRAPH_CHROME},children:Mi})]}),(0,qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Ni})),Di]}),(0,qe.jsx)($.SoldOutStrip,{rid:jt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:Ls,onClose:()=>Hs(!1),rid:jt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:jt}),At.elements,os?(0,qe.jsx)(y.EditBookingPicker,{rid:jt,today:Mt,who:Ht,onClose:()=>ns(!1)}):null,as?(0,qe.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:Ht,onClose:()=>rs(null)}):null,Jt?(0,qe.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Js,plan:_t,todays:Vs,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Fs}):null,kl?(()=>{const e=wl[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Rl(null),Il(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${dl?rl:(0,ze.dayLong)(nl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${dl?rl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${dl?rl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):st(e.name);return(0,qe.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Il(null),ps(e.id)},style:{minHeight:56}},e.id)}),nl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===nl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(kl)).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)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Tl?(0,qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Tl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Tl.ask}),(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!hi.ok,accessibilityHint:hi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Tl.id);if(Rl(null),!e)return;const s=st(e.name);Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Rl(null)})]})]}):null,Tl?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,qe.jsx)(Q.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:!hi.ok,accessibilityHint:hi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(As,{b:e,tables:[kl]}))return;const l=(0,De.overCapacityAsk)([kl],t,e.partySize);l?Rl({id:e.id,ask:l}):(Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Rl(null),Il(null)},style:{minHeight:56}})]})})():null,ys?(()=>{const e=It.find(e=>e.id===ys);return e?(0,qe.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):st(e.name),view:Js,now:Ct,otherDay:e.date!==Mt,turnBase:wt.settings.turnMins,onClose:()=>ps(null),onDetails:Fs,onDone:As,onEdit:e=>{ps(null),rs(e.id)},onPickOnPlan:(e,t)=>{hs(!1),Ut('plan'),Qt('all'),fs({id:e.id,tables:t})}}):null})():null,ts?(0,qe.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,Ai,ds?(0,qe.jsx)(Se.ServiceSummary,{r:wt,todays:Vs,orders:kt,waitlistAll:vs,walkInCount:Ss,onClose:()=>cs(!1)}):null,Cs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ts(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ts(!1)})]}):null,Bs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ws(!1),$s(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,Rs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,ls?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,qe.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(at,{list:Ks,me:Ht,bookings:It})]}):null,Es?(0,qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,qe.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Ns.current=Date.now(),null!==_s&&Gs(null)},notice:null!==_s?`Locking again in ${_s} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Os(null),As('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),As('Live seating plan updated on every screen.')},onCancel:()=>{Os(null),As('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,qe.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,qe.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,qe.jsx)(Re.TakeawayTakeover,{rid:jt,me:Ht})]});var Ni}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1346,[1069,797,5,6,1347,829,854,1108,861,1155,1348,1349,1350,1105,1135,1351,1352,1357,1358,1221,1359,873,1364,1365,1366,1128,1127,977,1367,1167,950,1118,1368,35,1088,1195,1027,1101,1151,1369,396,381,403,296,103,427,37,795,1248,1252,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1370,1122,1371,1378,1380,1383,1388,1382,1389,1391,1392,1130,1109,1110,879,1397,1237,1398,1247,1239,1004,1403,1408,1409,1070,1068,1132,1411,1412,1413,1087,1182,1414,1181,1174,870,1360,1415,26]); __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},1348,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1349,[1005,1073]); @@ -1488,7 +1488,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";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}:{}}))}},1405,[]); __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)}},1406,[879,859,878]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1407,[5,1007,904,958]); -__d(function(g,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,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:w,blocks:M=[],height:v=150,forecastNote:k,emptyText:$,past:D,closed:A,compact:I=!1,dense:C=!1,bare:L=!1,fill:_=!1,fit:z=!1,tight:H=!1,live:O=!1}){const[S,F]=(0,t.useState)(0),[P,R]=(0,t.useState)(0),N=j.getTime()-18e5,B=T.getTime()+36e5,E=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(N),new Date(B),w),[e,N,B,w]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(M,W,X),[M,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=z&&P?Math.max(24,Math.floor(P)):Math.max(48,v-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=C?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:O,past:D,closed:A}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},he=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),de=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&de.push(t.getTime())}const ue=O?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),xe=A?null:O?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,ge=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:de,busiest:xe}):{hours:[],busiest:null},me=he(E),pe=le?he(ae.before):me,fe=le?he(ae.after):'',ye=_&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,we=ge.busiest?.text??(A?'':O?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),Me=U.map(e=>e.spoken).join('. '),ve=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${we?` ${we}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${ve} percent of the way through the day.`:''}${Me?` ${Me}.`:''}`,$e=(0,u.hm)(b),De=Math.max(44,12*$e.length*.7+16),Ae=Math.max(q+2,Math.min(Math.max(0,S-J-De),se(re)-De/2)),Ie=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,z?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:L?4:C?2:10,paddingBottom:L?2:6,backgroundColor:c.colours.bg}],children:[L?null:I?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),L||H?null:A?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ke,onLayout:e=>{F(e.nativeEvent.layout.width),z&&R(e.nativeEvent.layout.height)},style:z?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,v-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,A?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,ge.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:ge.busiest.x+ge.busiest.w/2,y:ge.busiest.y+ge.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:ge.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Ae,top:Ie,minWidth:De,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),ge.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':i(0,f.coverCurve)(e,new Date(N),new Date(B),v),[e,N,B,v]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(w,W,X),[w,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=O&&P?Math.max(24,Math.floor(P)):Math.max(48,M-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=A?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:$,closed:I}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},de=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),he=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&he.push(t.getTime())}const ue=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),ge=I?null:H?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,xe=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:he,busiest:ge}):{hours:[],busiest:null},me=de(E),pe=le?de(ae.before):me,fe=le?de(ae.after):'',ye=z&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ve=xe.busiest?.text??(I?'':H?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),we=U.map(e=>e.spoken).join('. '),Me=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=!I&&K&&K.covers?(0,m.peakOccupancyText)(K.t,K.covers):'',De=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${ke?` ${ke}.`:''}${ve?` ${ve}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${Me} percent of the way through the day.`:''}${we?` ${we}.`:''}`,$e=(0,u.hm)(b),Ie=Math.max(44,12*$e.length*.7+16),Le=Math.max(q+2,Math.min(Math.max(0,S-J-Ie),se(re)-Ie/2)),Ae=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[h.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:C?4:A?2:10,paddingBottom:C?2:6,backgroundColor:c.colours.bg}],children:[C?null:L?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te}),ke?(0,y.jsx)(d.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:ke}):null]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:A?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),C||_?null:I?k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),ke&&!L?(0,y.jsx)(d.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:ke}):k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),C||_||L||!k||!ke?null:(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),C||!_||!ke||L?null:(0,y.jsx)(d.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:ke}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:De,onLayout:e=>{F(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,xe.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:xe.busiest.x+xe.busiest.w/2,y:xe.busiest.y+xe.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:xe.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(d.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Le,top:Ae,minWidth:Ie,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(d.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),xe.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1409,[]); __d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1410,[1092]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1411,[861,1390]); diff --git a/owner-desktop/index.html b/owner-desktop/index.html index a475e4665bf76de8d5ab8073049b5165447252e7..2631cfa27e602e67fd930f3d3b02a7df01def8f1 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 3a7bb6754ab3f9ec1f7450eebd9fc5444139537e..31acf92834df6d6f8dbeb8b6c67a4cc6043beffc 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 4ad00ca9870ddd71d03d25e3af9d374020acf696..1eeadcbb0ffd73d67b7678214dfe84bd67e5ae76 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-aba9c19bf1"; +const V = "cc-desk-d173a4d9cb"; 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=aba9c19bf19a65d0af028c524d61e598498595ab66ca4e5218f151748c6d4e82"]; +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=d173a4d9cb3c15a40cd28ea2349ed103b1a74112998235c5ef7b4e572d099a0b"]; // 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 a9bb0038a0fbd2dd7cf70cd0151cf8ae3f9c9c03..e382598af6965fe62b4a13a8d22420b9d3da5bc4 100644 --- a/staff-app/_expo/static/js/web/bundle.js +++ b/staff-app/_expo/static/js/web/bundle.js @@ -5,7 +5,7 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() !(function(r){let l=0,n=!0===r.RN$useAlwaysAvailableJSErrorHandling?r.RN$handleException:(r,l)=>{throw r};const t={setGlobalHandler(r){n=r},getGlobalHandler:()=>n,reportError(r){n&&n(r,!1)},reportFatalError(r){n&&n(r,!0)},applyWithGuard(r,n,e,a,o){try{return l++,r.apply(n,e)}catch(r){t.reportError(r)}finally{l--}return null},applyWithGuardIfNeeded:(r,l,n)=>t.inGuard()?r.apply(l,n):(t.applyWithGuard(r,l,n),null),inGuard:()=>!!l,guard(r,l,n){if('function'!=typeof r)return console.warn('A function must be passed to ErrorUtils.guard, got ',r),null;const e=l??r.name??'';return function(...l){return t.applyWithGuard(r,n??this,l,null,e)}}};r.ErrorUtils=t})('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof global?global:'undefined'!=typeof window?window:this); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,20]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&!t.PITCH_ANCHORAGE&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=o=>{if(3===o.nodeType){const e=o.nodeValue??'',a=(0,n.pitchText)(e,t.PITCH_ANCHORAGE);return void(a!==e&&(o.nodeValue=a))}if(1!==o.nodeType)return;const a=o;if('INPUT'===a.tagName||'TEXTAREA'===a.tagName){const e=a,o=(0,n.pitchText)(e.value,t.PITCH_ANCHORAGE);o!==e.value&&(e.value=o);const i=e.getAttribute('placeholder');if(i){const o=(0,n.pitchText)(i,t.PITCH_ANCHORAGE);o!==i&&e.setAttribute('placeholder',o)}}for(const e of['aria-label','title']){const o=a.getAttribute(e);if(o){const i=(0,n.pitchText)(o,t.PITCH_ANCHORAGE);i!==o&&a.setAttribute(e,i)}}a.childNodes.forEach(e)},o=()=>{e(document.body),document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE),new MutationObserver(o=>{for(const t of o)'characterData'===t.type?e(t.target):t.addedNodes.forEach(e),'attributes'===t.type&&e(t.target);document.title=(0,n.pitchText)(document.title,t.PITCH_ANCHORAGE)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?o():document.addEventListener('DOMContentLoaded',o)}}},1,[2,3,16,18,19]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!0},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_ANCHORAGE",{enumerable:!0,get:function(){return o}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("anchorage"),!1),o=n&&!1},2,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return c.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return R}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]);const u={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[6]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},h={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},f={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},b={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},p=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:f,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...u,orderAtTable:!1,pay:h,cashUpRecord:[...l.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:8,bookingNoticeMins:15,autoAcceptUpTo:8},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...u,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],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']},settings:{...u,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],A={by:'Fictional demo',at:'2026-10-26'},T=(t,n,o,s,c,l,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:c,price:l,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:A}),R=[T('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),T('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),T('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),T('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),T('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),T('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),T('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),T('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),T('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),T('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13,15]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="anchorage".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); @@ -1070,7 +1070,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()})},987,[35,988]); __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},988,[985,948,989]); __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'}},989,[985]); -__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.189'},990,[]); +__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.190'},990,[]); __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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},991,[992,993,904,948,988]); __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())}}}},993,[948]); @@ -1244,7 +1244,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 e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1161,[35,403,103,795,868,822,1154,1153,1158,1011,26]); __d(function(g,_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.ChefForecast=function({openPrep:e}){const{r:f,rid:y,now:b}=(0,u.useChef)(6e4),x=(0,l.useBookings)(y),p=(0,l.useOrders)(y),j=(0,l.useEvents)(y),k=(0,a.useRealHistory)(y,b),w=(0,d.ymd)(b),[T,$]=(0,o.useState)(7),{covers:v,enough:C,booked:D,pct:I,day:A,example:L}=(0,u.useForecast)(),M=0===I?`about a usual ${A}`:`${Math.abs(I)}% ${I>0?'busier':'quieter'} than a usual ${A}`,z=(0,o.useMemo)(()=>Array.from({length:T},(e,o)=>{const s=0===o?b:(0,d.addMins)((0,d.parseYmd)(w),1440*o),t=(0,i.forecastToday)(f,x,p,j,s,k??void 0);return{d:s,f:t,booked:t.hours.reduce((e,o)=>e+o.booked,0),covers:t.hours.reduce((e,o)=>e+o.covers,0)}}),[f,x,p,j,w,T,k,b.getTime()/6e5|0]),B=z[0].f,R=z.map(e=>({key:(0,d.ymd)(e.d),label:(0,d.dayShort)(e.d),spoken:(0,d.dayLong)(e.d),value:e.f.open?C?e.covers:e.booked:0,open:!!e.f.open}));return(0,h.jsxs)(t.default,{style:{gap:12},testID:"chef-forecast",children:[(0,h.jsx)(r.Muted,{center:!0,testID:"chef-forecast-busy",children:B.busy.words}),C?null:(0,h.jsx)(a.NotEnoughHistory,{weeks:B.minWeeks,booked:D}),(0,h.jsxs)(r.Card,{children:[(0,h.jsxs)(t.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,h.jsxs)(r.T,{center:!0,weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:[7===T?'This week':`Next ${T} days`," \xb7 ",C?'forecast covers':'booked covers']}),C?B.example?(0,h.jsx)(a.ExampleBadge,{}):(0,h.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"}):null]}),(0,h.jsx)(r.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,h.jsx)(r.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:T===e,onPress:()=>$(e),testID:`chef-forecast-range-${e}`},e))}),(0,h.jsx)(c.DaysLineGraph,{days:R,titleSpoken:`${C?'Forecast':'Booked'} covers for the next ${T} days`})]}),(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,accessibilityRole:"header",children:"Covers per day"}),(0,h.jsxs)(t.default,{testID:"chef-forecast-days",children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',paddingVertical:6,borderBottomWidth:1,borderColor:n.colours.hairline},children:[(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{flex:1,textAlign:'left'},children:"Day"}),(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:72,textAlign:'right'},children:"Booked"}),C?(0,h.jsx)(r.T,{size:12,weight:"semibold",colour:n.colours.muted,style:{width:84,textAlign:'right'},children:"Forecast"}):null]}),z.map((e,o)=>{const s=0===o;return(0,h.jsxs)(t.default,{testID:`chef-forecast-day-${(0,d.ymd)(e.d)}`,accessible:!0,accessibilityLabel:e.f.open?`${(0,d.dayLong)(e.d)}: ${e.booked} booked${C?`, about ${e.covers} forecast`:''}`:`${(0,d.dayLong)(e.d)}: closed`,style:{flexDirection:'row',alignItems:'center',minHeight:40,borderBottomWidth:o({minHeight:48,borderRadius:12,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:e?n.colours.goldTint:'transparent'}),children:(0,h.jsx)(r.T,{weight:"semibold",colour:n.colours.gold,children:"Open prep list \u203a"})})]})]})};var o=_r(_d[0]),s=e(_r(_d[1])),t=e(_r(_d[2])),r=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),d=_r(_d[6]),n=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11])},1162,[35,403,103,795,875,1155,859,822,1163,1159,1158,26]); __d(function(g,_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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1163,[829,35,284,365,237,103,427,798,795,828,822,1164,26]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,l=u,f=Math.max(10,i-s-l),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let M=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(p=n.busiest.t,s+(p-n.t0)/x*f-o/2);M={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var p;return{hours:b,busiest:M}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xf+(t-c)/M*b,w=l.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:p(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',f=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=l.indexOf(n);return t+(o<0?1e3:f[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CHART_PAD_L",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CHART_PAD_R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=s,e.busiestText=c,e.peakOccupancyText=function(t,n){const o=String(new Date(t).getHours()).padStart(2,'0');return`Peak ${n} ${1===n?'cover':'covers'} at ${o}:00`},e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=h,e.dayLabelWidth=x,e.daysAxis=function(n,o,u=1){if(!o.length||n<=0)return[];const a=Math.max(10,n-28-8),i=Math.max(1,o.length-1),s=t=>o.length<=1?28+a/2:28+t/i*a,c=t=>t.every((o,u)=>o.x>=0&&o.x+o.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=o.x)),h=(a,i)=>{const h=o.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%a===0).map(({t:o,i:a})=>{const c=o.length>i?o.slice(0,i):o,h=Math.min(n,x(c,u));return{x:Math.max(0,Math.min(n-h,s(a)-h/2)),y:0,w:h,h:t,text:c}});return c(h)?h.map((t,o)=>{const u=0===o?0:(h[o-1].x+h[o-1].w+t.x)/2+1,a=o===h.length-1?n:(t.x+t.w+h[o+1].x)/2-1,i=Math.max(0,t.x-u),s=Math.max(0,a-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+s,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-i,w:t.w+i,align:'right'};const c=Math.min(i,s);return{...t,x:t.x-c,w:t.w+2*c,align:'center'}}):null};for(let t=1;t<=o.length;t++){const n=h(t,3);if(n)return n;if(t>1){const n=h(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),s=o,f=u,l=Math.max(10,i-s-f),x=Math.max(1,n.t1-n.t0),b=h(i,n.t0,n.t1,n.hours).map(o=>({...o,y:Math.max(0,n.height-t)}));let p=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??c(n.busiest.t,n.busiest.covers),o=Math.min(i,a(t,13)),u=(M=n.busiest.t,s+(M-n.t0)/x*l-o/2);p={x:Math.max(0,Math.min(i-o,u)),y:1,w:o,h:16,text:t}}var M;return{hours:b,busiest:p}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours},e.yTicks=function(t){const n=1.15*Math.max(8,t),o=[1,2,5,10,15,20,25,50,100];let u=5;for(const t of o){const o=Math.floor(n/t)*t,a=Math.round(o/t)+1;if(a>=2&&a<=3){u=t;break}}const a=[];for(let t=0;t<=n+1e-9;t+=u)a.push(Math.round(t));0!==a[0]&&a.unshift(0);return[...new Set(a)]},e.nowLineVisible=function(t){if(t.closed||t.past||!0!==t.live)return!1;const n=t.now.getTime(),o=t.open.getTime(),u=t.close.getTime();return n>=o&&n<=u},e.splitCurve=function(t,n){const o=[],u=[];let a=null;for(let i=0;in&&u.push(s),c&&s.tn){const t=(n-s.t)/(c.t-s.t);a={t:n,covers:s.covers+t*(c.covers-s.covers)}}}a&&(o.length&&o[o.length-1].t===a.t||o.push(a),u.length&&u[0].t===a.t||u.unshift(a));return{before:o,after:u}},Object.defineProperty(e,"YTICK_MIN_PLOT",{enumerable:!0,get:function(){return b}}),e.fitYTicks=function(t,n,o,u=13){const a=Math.max(26,Math.ceil(1.5*Math.max(u,13))+6);if(!t.length||ot.topo-4||h.push(c))}return h.sort((t,n)=>t.value-n.value)};const t=22,n=12,o=44,u=8,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.xl+(t-c)/p*b,w=f.map(o=>{const u=String(new Date(o).getHours()).padStart(2,'0'),i=a(u,n);return{x:M(o)-i/2,y:0,w:i,h:t,text:u}});for(let t=1;t<=Math.max(1,w.length);t++){const n=w.filter((n,o)=>o%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!s(n))return n}return[]}const f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',l=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function x(t,o=1,u=n){const a=[...t].reduce((t,n)=>{const o=f.indexOf(n);return t+(o<0?1e3:l[o])},0)/1e3;return Math.ceil(a*u*Math.max(1,o))+4}const b=72},1164,[]); __d(function(g,_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.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,I.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,I.useForecast)(),f=(0,k.ymd)(i),p=(0,R.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),m=p.reduce((e,t)=>e+t.sold,0)||1,x=p.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/m)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),b={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{b[e.ing]=(b[e.ing]??0)+e.qty*t.qty}));const y=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini-fish-goujons','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,$.fmtQty)(Math.ceil(2*(b.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,$.fmtQty)(Math.ceil(10*(b.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,$.fmtQty)(Math.ceil(10*(b.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,$.fmtQty)(Math.ceil(2*(b.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,D.useKitchen)(e=>e.tickPrep),w=[...y.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=w.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,q.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,q.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} Covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,q.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} Covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," Covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,q.jsx)(u.Badge,{kind:S===w.length?'ok':'gold',label:`${S}/${w.length} done`})]}),w.map((t,i)=>{const n=e.prepTicks[t.key];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?C.colours.ok:C.colours.border,backgroundColor:C.colours.surface,marginTop:i===y.length?8:0},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:C.colours.muted}:void 0,children:t.text}),n?(0,q.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,q.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,I.useChef)(),a=(0,I.useWeek)(),d=(0,D.useKitchen)(e=>e.addWaste),[f,p]=(0,o.useState)(e.ingredients[0]?.id),[m,x]=(0,o.useState)(''),[b,y]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),k=Number(m.replace(',','.'))||0,S=k>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*k)),T=w&&S?(0,s.inputQuantity)(l,w,k):0,v=e.waste.filter(e=>(0,I.within7)(e.at,r));return w?(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,q.jsx)(I.Tile,{label:"Waste this week",value:(0,j.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,q.jsx)(I.Tile,{label:"Waste as % of food sales",value:a.sales?(0,I.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,q.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,q.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,q.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>p(e.id)},e.id))})}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:m,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:C.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),(0,q.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,q.jsx)(u.T,{weight:"semibold",colour:C.colours.gold,children:(0,j.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,q.jsxs)(u.Row,{children:[(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(k)-.5)))}),(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(k)+.5))}),(0,q.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:D.WASTE_REASONS.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===b,onPress:()=>y(e)},e))}),(0,q.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:b,cost:Math.round(T*w.cost)}),x('')}}),(0,q.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,q.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,q.jsx)(u.T,{size:14,children:(0,j.gbp)(e.cost)})]},e.id))]}):(0,q.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,I.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,b.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'},c=(0,m.useUnsignedDishes)(i),[x,j]=(0,o.useState)(!1);return x?(0,q.jsx)(m.UnsignedDishList,{rid:i,actor:a,onClose:()=>j(!1),onOpenCards:e}):(0,q.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,q.jsx)(d.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>j(!0),style:({pressed:e})=>({minHeight:48,opacity:e?.85:1}),children:(0,q.jsxs)(u.Card,{style:{alignItems:'center'},highlight:c.length?C.colours.amber:void 0,children:[(0,q.jsx)(u.Muted,{center:!0,children:"Dishes not signed off"}),(0,q.jsx)(u.T,{center:!0,size:20,weight:"bold",children:c.length})]})}),(0,q.jsx)(u.Muted,{children:"The 14 allergens from each recipe card. These are what guests see on the menu, takeaway and the booking allergy check. A red warning means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,q.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,l.map(({card:e,fromCosting:t})=>(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",center:!0,children:e.dish}),(0,q.jsx)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i,r='contains'===i?'Contains':'may'===i?'May contain':n?'In costing recipe, not on card':'Not listed';return(0,q.jsxs)(h.default,{accessible:!0,accessibilityLabel:`${e.dish}, ${s.label}: ${r}`,style:{flexGrow:1,flexBasis:220,minWidth:180,maxWidth:'100%',padding:8,borderRadius:8,backgroundColor:n?C.colours.redBg:C.colours.surface2},children:[(0,q.jsx)(u.T,{center:!0,size:14,weight:"semibold",children:s.label}),(0,q.jsx)(u.T,{center:!0,size:14,colour:n?C.colours.red:'contains'===i?C.colours.gold:C.colours.muted,children:r})]},s.id)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Not listed means the allergen is not recorded on this recipe card. Check any costing warnings before sign-off."}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,q.jsxs)(u.Card,{highlight:s.length?C.colours.red:C.colours.amber,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,q.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,q.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,q.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,p.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,q.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,q.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,q.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,I.useChef)(),l=(0,k.ymd)(i),a=(0,D.useKitchen)(e=>e.addTemp),c=(0,x.useOwner)(e=>e.checks),{tick:f,untick:p}=x.useOwner.getState(),[m,b]=(0,o.useState)('fridge'),y=E.find(e=>e.id===m),j={...y,units:y.units.filter(e=>(0,n.chefCanSee)(r,e))},[w,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,M=e.temps.filter(e=>e.at.slice(0,10)===l),B=(e,t,i)=>{const n=c[e];return(0,q.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?p(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,q.jsx)(u.T,{size:18,colour:n?C.colours.ok:C.colours.muted,children:n?'\u2611':'\u2610'}),(0,q.jsxs)(h.default,{style:{flex:1},children:[(0,q.jsx)(u.T,{size:14,children:t}),(0,q.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:E.map(e=>(0,q.jsx)(u.Chip,{label:e.label,selected:e.id===m,onPress:()=>{b(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,q.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,q.jsx)(u.Chip,{label:e,selected:e===w,onPress:()=>S(e)},e))}),(0,q.jsx)(u.Muted,{children:j.rule}),(0,q.jsxs)(u.Row,{gap:8,children:[(0,q.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:C.colours.muted,style:{width:90,borderWidth:1,borderColor:C.colours.border,borderRadius:8,padding:8,color:C.colours.text}}),null===$?null:(0,q.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,q.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:m,unit:w,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,q.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",M.length,")"]}),M.length?M.map(e=>{const t=E.find(t=>t.id===e.kind)?.ok(e.temp);return(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,q.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,q.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?C.colours.ok:'warn'===t?C.colours.amber:C.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,q.jsx)(u.Muted,{children:"None yet today."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,q.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),G.map(e=>B(`${l}:kc-${e.id}`,e.text))]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),F.map(e=>B('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,I.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,v.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??I.CHEF_ID,role:'staff'}),[d?.id]),u=(0,T.useChatOpen)(e=>e.ch);return(0,o.useEffect)(()=>{u&&a('chat')},[u]),(0,q.jsx)(S.ChatAsCtx.Provider,{value:c,children:(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(H,{sub:r,setSub:a}),'live'===r?(0,q.jsx)(_,{}):'soldout'===r?(0,q.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,q.jsx)(V,{}):(0,q.jsx)(U,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),D=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),z=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]),N=_r(_d[36]),W=_r(_d[37]),q=_r(_d[38]);const E=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],F=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],G=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function H({sub:e,setSub:t}){const{total:s}=(0,S.useChatUnread)();return(0,q.jsx)(I.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function U(){return(0,q.jsx)(S.Chat,{go:()=>{}})}function _(){const{rid:e,r:t,me:s,now:i}=(0,I.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))),c=(e,t)=>!!(0,B.statusBlock)(e,t,(0,B.linkedBooking)(e,n)),p=(0,b.ticketView)('chef',d),m=(0,f.useStore)(e=>e.setOrderStatus),x=(0,f.useStore)(e=>e.ackReadiness),j=d.flatMap(e=>(0,w.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,q.jsxs)(h.default,{style:{gap:8},children:[j.length?(0,q.jsx)(u.Banner,{kind:"warn",title:`${j.length} readiness alert${j.length>1?'s':''}`,children:j.map(e=>e.detail).join(' \xb7 ')}):(0,q.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,q.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,p.length?p.map(e=>(0,q.jsxs)(u.Card,{highlight:e.allergies.length&&(0,B.nextStep)(e,(0,B.linkedBooking)(e,n))&&'ready'!==e.status?C.colours.red:void 0,children:[(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`Table ${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,q.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,q.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,q.jsxs)(u.T,{size:13,colour:C.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,q.jsxs)(u.T,{size:13,colour:C.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,q.jsx)(M.AllergyChain,{o:e,me:s}):null,(0,q.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{m(e.id,'preparing',s),'takeaway'===e.type&&x(e.id,'cook',s)}}):null,'ready'!==e.status?(0,q.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>m(e.id,'ready',s)}):null]})]},e.id)):(0,q.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const K=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,k.ymd)(new Date(s,i-1,n+t))};function V(){const{now:e,today:t}={...(0,I.useChef)(6e4),today:(0,k.ymd)(new Date)},{staff:s,shifts:i}=(0,b.rotaView)('chef',(0,x.useOwner)(e=>e.staff),(0,x.useOwner)(e=>e.shifts)),n=(0,x.useOwner)(e=>e.leave),r=(0,N.canEditKitchenRota)((0,P.useSync)(e=>e.perms)),l=(0,x.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),a=(0,v.weekday)(e),o=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),d=(0,z.useSession)(e=>e.meId),c=(0,P.useSync)(e=>e.staffRef),f=d??c??I.CHEF_ID,p=(0,x.useOwner)(e=>e.staff.find(e=>e.id===f)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,q.jsxs)(h.default,{style:{gap:10},children:[(0,q.jsx)(L.BreakRoomCard,{staffId:f,name:p,now:e}),(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"On now"}),l.length?l.map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,q.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,q.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,q.jsxs)(u.Card,{children:[(0,q.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",v.DAY3[a],")"]}),i.filter(e=>e.date===t).map(e=>(0,q.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,q.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,q.jsx)(O.StaffAvatar,{id:e.staffId,size:28}),(0,q.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,W.leaveCovering)(n,e.staffId,e.date)?(0,q.jsx)(u.T,{size:13,colour:C.colours.blue,children:(0,W.leaveLabel)((0,W.leaveCovering)(n,e.staffId,e.date))}):(0,q.jsxs)(u.Muted,{children:[(0,v.fmtH)(e.start),"\u2013",(0,v.fmtH)(e.end)]})]},e.id))]}),r?(0,q.jsx)(u.Card,{children:(0,q.jsx)(A.KitchenRotaEditor,{today:t})}):(0,q.jsxs)(u.Card,{children:[(0,q.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),o.map(e=>(0,q.jsxs)(h.default,{style:{gap:4},children:[(0,q.jsx)(u.T,{size:14,children:e.name}),(0,q.jsx)(u.Row,{wrap:!0,gap:4,children:v.DAY3.map((s,n)=>{const r=i.find(s=>s.staffId===e.id&&s.date===K(t,n-a));return(0,q.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:r?C.colours.goldTint:C.colours.surface2,alignItems:'center'},children:[(0,q.jsx)(u.T,{size:10,colour:C.colours.muted,children:s}),(0,q.jsx)(u.T,{size:10,children:r?`${(0,v.fmtH)(r.start).slice(0,2)}\u2013${(0,v.fmtH)(r.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,q.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})]})}},1165,[828,955,1166,836,861,1167,1168,35,403,296,103,795,875,883,1169,892,966,862,868,1172,859,822,1173,1099,1073,1154,1153,1174,870,1158,1011,896,1175,977,958,1178,961,1087,26]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1166,[1153,955]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1167,[828,35,103,795,875,950,892,951,952,953,832,822,26]); @@ -1261,7 +1261,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";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=w,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,l.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,y.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,y.jsx)(w,{today:e}):(0,y.jsx)(I,{today:e})})},_e.KitchenRotaRead=I;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],j=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,k=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,p=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function w({today:e=(0,h.ymd)(new Date)}){const r=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,l.kitchenTeam)(r),[r]),$=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[w,I]=(0,t.useState)(0),S=(0,f.useDateCalendar)(),[v,C]=(0,t.useState)(null),[T,H]=(0,t.useState)(''),P=(0,a.addDays)((0,a.mondayOfDate)(e),7*w),L=(0,a.addDays)(P,6),R=b.map((e,t)=>(0,a.addDays)(P,t)),M=(0,l.kitchenPending)(o,$,P,L).length,O=e=>{H(e),(0,u.announce)(e)},W=0===w?'This week':1===w?'Next week':-1===w?'Last week':`Week of ${k(P)}`;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center',flexWrap:'nowrap'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(w-1),H('')},style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${W}, ${x[0]} ${k(P)} to ${x[6]} ${k(L)}`,style:{alignItems:'center',minWidth:120,flex:1},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:W}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(P)," \u2013 ",j(L)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(w+1),H('')},style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:S.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:S.calOpen,today:e,day:P,showBusy:!0,idPrefix:"krota-cal",onClose:S.closeCal,onDay:t=>{I((0,f.weekOffsetOf)(t??e,e)),H('')}}),d.map(t=>(0,y.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[p(t.nickname||t.name),t.job?(0,y.jsx)(n.T,{size:12,colour:m.colours.muted,children:` ${t.job}`}):null]}),(0,y.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:R.map((i,a)=>{const l=o.find(e=>e.staffId===t.id&&e.date===i),r=!(!l||l.published&&!l.changed),d=`${p(t.nickname||t.name)}, ${x[a]} ${k(i)}, ${l?`${(0,c.fmtH)(l.start)} to ${(0,c.fmtH)(l.end)}${r?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,y.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>C({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:r?'dashed':'solid',borderColor:l?r?m.colours.amber:m.colours.gold:m.colours.border,backgroundColor:e||l?m.colours.goldTint:m.colours.surface2}),children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:i===e?m.colours.gold:m.colours.muted,children:b[a]}),(0,y.jsx)(n.T,{size:10,center:!0,children:l?`${(0,c.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(l.end).slice(0,5)}):(0,y.jsx)(n.T,{size:10,center:!0,colour:m.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,y.jsx)(n.Button,{testID:"krota-publish",kind:M?'primary':'secondary',disabled:!M,label:M?`Publish kitchen rota (${M} ${1===M?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:M?`Publish the kitchen rota for ${W.toLowerCase()}, ${M} ${1===M?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,$,P,L);a.useOwner.getState().setShifts(e.shifts),O(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,y.jsx)(i.default,{testID:"krota-msg",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.goldLight,children:T})}):null,(0,y.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),v?(0,y.jsx)(D,{init:v,onClose:()=>C(null),onSaid:O}):null]})}function I({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:l}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,$]=(0,t.useState)(0),w=(0,f.useDateCalendar)(),I=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),D=(0,a.addDays)(I,6),S=b.map((e,t)=>(0,a.addDays)(I,t)),v=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),C=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${k(I)}`,[T,H]=(0,t.useState)(0),P=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,y.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>H(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,y.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>$(u-1),style:{minWidth:84,minHeight:48}}),(0,y.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${C}, ${x[0]} ${k(I)} to ${x[6]} ${k(D)}`,style:{alignItems:'center',minWidth:120},children:[(0,y.jsx)(n.T,{weight:"semibold",center:!0,children:C}),(0,y.jsxs)(n.Muted,{center:!0,children:[j(I)," \u2013 ",j(D)]})]}),(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>$(u+1),style:{minWidth:84,minHeight:48}})]}),(0,y.jsx)(i.default,{style:{alignItems:'center'},children:(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:w.openCal,style:{minWidth:84,minHeight:48}})}),(0,y.jsx)(f.AppDateCalendar,{visible:w.calOpen,today:e,day:I,showBusy:!0,idPrefix:"krota-read-cal",onClose:w.closeCal,onDay:t=>$((0,f.weekOffsetOf)(t??e,e))}),v.map(t=>(0,y.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:p(t.nickname||t.name)}),(0,y.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=l.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,r.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,r.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,y.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${p(t.nickname||t.name)}, ${x[a]} ${k(s)}, ${u}`,style:{width:P,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.goldTint:m.colours.surface2},children:[(0,y.jsx)(n.T,{size:10,center:!0,colour:s===e?m.colours.gold:m.colours.muted,children:b[a]}),o&&h?(0,y.jsx)(n.T,{size:9,center:!0,colour:m.colours.blue,children:(0,r.leaveLabel)(h).toLowerCase()}):(0,y.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,y.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),v.length?null:(0,y.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,y.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function D({init:e,onClose:s,onSaid:r}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=p(o?.nickname||o?.name||''),[u,f]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[j,w]=(0,t.useState)(!1),[I,D]=(0,t.useState)(''),S=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${k(e.date)})`;return(0,y.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${S}`,testID:"krota-sheet",children:(0,y.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,y.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,y.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{f(t),x(s)}},e))}),(0,y.jsx)(n.T,{center:!0,children:"Start"}),(0,y.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:f,format:c.fmtH,label:"Start time"}),(0,y.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,y.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,y.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),I?(0,y.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,y.jsx)(n.T,{center:!0,colour:m.colours.amber,children:I})}):null,(0,y.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?D(`${d} already has a shift that overlaps on ${S}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),r(`${e.shift?'Changed':'Added'}: ${d}, ${S}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!j?(0,y.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&j?(0,y.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,y.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",S,"?"]}),(0,y.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),r(`Removed ${d}'s shift on ${S}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,y.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1178,[35,403,103,795,892,961,1087,966,958,1076,859,1111,1067,822,26]); __d(function(g,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.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1179,[1166,955,35,380,103,795,892,966,868,822,1073,1158,1011,1180,26]); __d(function(g,_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.openLink=w,_e.useSheetReminders=C,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=C(),f=(0,b.wd)(l);return(0,j.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,j.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,j.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,j.jsx)($,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,j.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]);function w(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function k(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const S={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},T={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function C(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function $({s:e,open:n,onToggle:o}){const{rid:C,r:$,me:D,now:I}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),M=(0,u.useOrderSheets)(e=>e.markOpened),B=(0,u.useOrderSheets)(t=>t.opened[e.id]),[L,P]=(0,s.useState)({}),[O,R]=(0,s.useState)(''),[A,z]=(0,s.useState)(''),[_,W]=(0,s.useState)(!1),H=(0,h.useShellfish)(C,D,'chef'),K=(0,b.nextDelivery)(e,I),E=(0,b.orderLines)(e,L,O,C),N=($.address??$.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=N.length>=3?N[1]:N[0]??'',U=(0,b.orderMessage)(e,$.name,q,E,D.split(' ')[0],I),Q=e.orderDays.includes((0,b.wd)(I)),Y=(e,t)=>P(n=>({...n,[e.id]:(0,l.stepQuantity)(C,e,n[e.id]||0,t)})),F=t=>{M(e.id,I.toISOString()),w(t)},G='text'===e.method||'whatsapp'===e.method||'phone'===e.method,V=Math.round(100*((0,y.parseMoneyInput)(A)??NaN)),J=H.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),X=J.filter(e=>H.isLow(e.key));return(0,j.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:Q||X.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,j.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[S[e.method]," ",e.name]}),(0,j.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,j.jsx)(i.Muted,{children:e.goods}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,j.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,j.jsx)(i.Badge,{kind:Q?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,j.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,j.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,J.length?(0,j.jsx)(i.Badge,{kind:X.length?'amber':'ok',label:J.map(e=>`${e.icon} ${(0,c.fmtStockCount)(C,e,H.counts[e.key]??0)}`).join(' \xb7 ')}):null,B&&new Date(B).toDateString()===I.toDateString()?(0,j.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,j.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[K?(0,j.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(K),"."]}):null,e.reminder?(0,j.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,j.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,j.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,j.jsxs)(d.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{children:[e.name,e.unit?(0,j.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(C,e),")"]}):null]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Y(e,-1),style:{minWidth:44,minHeight:44}}),(0,j.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(C,e,L[e.id]||0),children:(0,j.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(C,e)?(0,l.fishQtyText)(C,e,L[e.id]||0):L[e.id]||0})}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(C,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Y(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,j.jsx)(t.TextInput,{value:O,onChangeText:R,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[T,{minHeight:60}]})]}),G?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(C,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,'online'===e.method?(0,j.jsxs)(d.default,{style:{gap:4},children:[(0,j.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,j.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(C,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:T})]}):null,e.priceCapPerKg?(0,j.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,j.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,j.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,j.jsx)(t.TextInput,{testID:"price-found",value:A,onChangeText:e=>z((0,y.sanitiseMoneyTyping)(e)),keyboardType:"decimal-pad",inputMode:"decimal",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[T,{width:120}]})]}),V>0?(0,j.jsx)(i.Badge,{kind:V<=e.priceCapPerKg?'ok':'red',label:V<=e.priceCapPerKg?`${(0,p.gbp)(V)}/kg is under the cap \u2713`:`${(0,p.gbp)(V)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,j.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,j.jsx)(i.T,{size:f.font.small,children:E.length?U:'Add quantities above to write the order.'})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!E.length,onPress:()=>F((0,b.smsLink)(e.number,U))}):null,'whatsapp'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!E.length,onPress:()=>F((0,b.waLink)(e.number,U))}):null,'phone'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>F((0,b.telLink)(e.number))}):null,'online'===e.method?(0,j.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>F(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&E.length?(0,j.jsx)(i.Button,{kind:"ghost",label:_?'Copied \u2713':'Copy order',onPress:async()=>{const e=await k(U);W(e),e&&setTimeout(()=>W(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&E.length?(0,j.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,j.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,j.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1180,[828,836,955,35,380,237,403,103,795,1009,954,956,868,1010,822,1158,14,26]); -__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); +__d(function(g,_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,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d,readOnly:m=!1}){const b=(0,h.useShellfish)(e,t,s),f=$(e),[p,k]=(0,o.useState)(!1),x=T(e,b.items.find(e=>e.supplierId)?.supplierId),v=(0,r.useLiveState)();if('ready'!==v)return(0,j.jsx)(r.LiveWait,{state:v,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!b.items.length)return null;const w=b.items.filter(e=>b.isLow(e.key)),C=b.items.length<=3?b.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:w.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${b.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)}`).join(', ')}${m?'':'. Tap to update'}`,onPress:()=>{m||k(!0)},disabled:m,style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",C]}),m?null:(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:b.items.map(t=>{const s=b.counts[t.key]??0,o=b.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!n&&w.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",w.map(t=>`${(0,u.fmtStockCount)(e,t,b.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:x?`Order from ${x} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||w.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:x?`${x} order sheet \u203a`:'Order sheets \u203a'})}),p?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>k(!1),onOrder:l?()=>{k(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',justifyContent:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},1181,[955,873,35,957,1182,337,403,103,1183,795,956,954,1009,822,875,1071,859,1111,958,26]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},1182,[5,823,824,829,237,827]); __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,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',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,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',w:64,h:45}}},1183,[]); __d(function(g,_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(', '))})]})}},1184,[828,1009,1166,955,35,403,103,795,892,868,822,1158,1011,14,26]); @@ -1295,7 +1295,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.AssignRoleSheet=function({name:e,when:s,current:u,onSave:b,onEditTimes:y,onClose:j}){const x={minHeight:o.IS_CAR?64:56,width:'100%'},_=(0,l.cleanBadge)(u);return(0,c.jsxs)(n.Sheet,{visible:!0,onClose:j,title:"Assign a role?",testID:"assign-role-sheet",maxWidth:560,children:[(0,c.jsx)(n.T,{size:18,center:!0,weight:"semibold",children:e}),(0,c.jsx)(n.Muted,{center:!0,children:s}),(0,c.jsxs)(t.default,{style:{gap:8,width:'100%'},children:[l.ROLE_BADGES.map(e=>(0,c.jsx)(n.Button,{kind:_===e?'primary':'secondary',label:e,testID:`assign-role-${h(e)}`,accessibilityLabel:`${e}${_===e?', chosen':''}`,onPress:()=>b(e),style:x},e)),(0,c.jsx)(n.Button,{kind:_?'secondary':'primary',label:"None",testID:"assign-role-none",accessibilityLabel:_?'None, clear the role badge':'None, chosen',onPress:()=>b(void 0),style:x}),y?(0,c.jsx)(n.Button,{kind:"ghost",label:"Edit shift times",testID:"assign-role-edit-times",onPress:y,style:x}):null]})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),o=r(d[4]),c=r(d[5]);const h=e=>e.replace(/\s+/g,'-').toLowerCase()},1212,[35,103,795,1211,873,26]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1213,[35,103,795,892,822,1073,1076,1209,1087,26]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1214,[35,103,1073,822,795,26]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),f=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),u=(0,n.useOwner)(e=>e.staff),x=(0,o.workingNow)(f,u,t),w=(0,o.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:r.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:r.colours.muted,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:r.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:r.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:w,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:r.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:o.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:r.colours.muted,center:!0,testID:"whos-on-shift-empty",children:o.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:r.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:r.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),h=_r(d[7])},1215,[35,103,1073,892,1216,822,795,26]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:t=!1,marquee:s=!1}={}){const{today:u}=(0,o.useCtx)(15e3),p=(0,l.useOwner)(e=>(0,l.liveAttendance)(e.attendance)),j=(0,l.useOwner)(e=>e.staff),I=(0,r.workingNow)(p,j,u),D=(0,r.cardSpeech)(I),[k,v]=(0,e.useState)(0),[L,S]=(0,e.useState)(0),[W,O]=(0,e.useState)(y);if((0,e.useEffect)(()=>{t&&s&&x()},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'function'!=typeof window.matchMedia)return;const e=window.matchMedia('(prefers-reduced-motion: reduce)'),n=()=>O(!!e.matches);return n(),e.addEventListener?e.addEventListener('change',n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener('change',n):e.removeListener(n)}},[t,s]),(0,e.useEffect)(()=>{if(!t||!s||!f||'undefined'==typeof ResizeObserver)return;const e=document.querySelector('[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]');if(!e)return;const n=()=>{const t=e.querySelector('[data-testid="whos-on-shift-list"]');v(e.clientWidth),t&&S(Math.max(t.scrollWidth,t.offsetWidth))},o=new ResizeObserver(n);o.observe(e);const l=e.querySelector('[data-testid="whos-on-shift-list"]');return l&&o.observe(l),n(),()=>o.disconnect()},[t,s,I.length,D]),t&&s){const e=k>0&&L>k+1&&f&&!W,t=w.find(e=>e>=Math.round((L+48)/32))??80,s=0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,numberOfLines:1,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",children:(0,h.jsx)(b,{rows:I,testIds:!0})});return(0,h.jsxs)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:0,paddingHorizontal:10,height:44,maxHeight:44,minHeight:44,overflow:'hidden',width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',gap:8},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",numberOfLines:1,style:{flexShrink:0},children:r.CARD_TITLE}),(0,h.jsxs)(n.default,{testID:"whos-on-shift-marquee",onLayout:e=>v(e.nativeEvent.layout.width),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,height:44,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:[(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",onLayout:e=>S(e.nativeEvent.layout.width),style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row',flexWrap:'nowrap',flexShrink:0,width:'max-content'},children:(0,h.jsx)(b,{rows:I,testIds:!1})}),e?(0,h.jsxs)(n.default,{dataSet:{ccwho:`tick-${t}`},style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center'},children:[(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:s}),(0,h.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,paddingRight:48},children:(0,h.jsx)(b,{rows:I,testIds:!1})})]}):(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',flexShrink:0,width:'max-content'},children:s})]})]})}if(t)return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'stretch',justifyContent:'center',flexShrink:1,minWidth:0,maxWidth:'100%',minHeight:44,overflow:'hidden'},children:(0,h.jsxs)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'flex-start',alignItems:'center',minWidth:0,maxWidth:'100%',width:'100%'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:d.colours.gold,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:13,colour:d.colours.muted,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'flex-start',alignItems:'center',flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(n.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:D,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:d.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===I.length?(0,h.jsx)(c.T,{size:18,colour:d.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(n.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:I.map(e=>(0,h.jsxs)(n.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:d.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:d.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]);const f='undefined'!=typeof document,w=[18,24,32,40,50,64,80],u=`\n[data-testid="display-whos-on-top"]{overflow:hidden;max-width:100%;width:100%}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"],\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"] *{flex-wrap:nowrap!important;white-space:nowrap}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-list"]{display:inline-flex!important;flex-direction:row;align-items:center;width:max-content!important;max-width:none!important}\n[data-testid="display-whos-on-top"] [data-testid="whos-on-shift-marquee"]>[data-ccwho],[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;width:max-content}\n${w.map(e=>`[data-testid="display-whos-on-top"] [data-ccwho="tick-${e}"]{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;animation:ccwho-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccwho-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-testid="display-whos-on-top"] [data-ccwho^="tick"]{animation:none!important}}\n`;let p=!1;function x(){if(!f||p)return;p=!0;const e=document.createElement('style');e.setAttribute('data-ccwho-css','1'),e.textContent=u,document.head.appendChild(e)}const y=()=>f&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;function b({rows:e,testIds:t}){return(0,h.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',columnGap:10,flexShrink:0,width:'max-content'},children:e.map(e=>(0,h.jsxs)(n.default,{testID:t?`whos-on-shift-${e.staffId}`:void 0,accessible:t,accessibilityLabel:t?e.speech:void 0,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:d.colours.text,numberOfLines:1,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:d.colours.muted,numberOfLines:1,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})}},1215,[35,237,103,1073,892,1216,822,795,26]); __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1216,[]); __d(function(g,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.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1217,[828,1042,35,403,103,795,1012,822,901,26]); __d(function(g,_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.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1218,[828,797,1219,1143,836,892,35,337,403,103,795,1012,1013,822,896,901,1220,1223,1225,26]); @@ -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,[828,861,35,103,795,862,868,1168,1338,875,822,26]); __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,[904,958,1168]); __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,[31,35,873,1340,1410,26]); -__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=e(_r(_d[40])),G=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]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ye.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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:l?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:l?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),s?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.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||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ye.jsx)(Q.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${s.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ye.jsx)(Q.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ye.jsx)(Q.T,{size:12,colour:se.colours.muted,children:l}):null]})}function at({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,s));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:l?16:18,weight:"bold",children:[it(e)," \xb7 ",lt(e.customerName)]}),(0,Ye.jsx)(Q.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,Ye.jsxs)(Q.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,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Q.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,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,le.useRestaurant)(jt);(0,Re.useAlertWatcher)(jt,{enabled:!e});const kt=(0,le.useOrders)(jt),It=(0,le.useBookings)(jt),Dt=(0,le.useEvents)(jt),vt=(0,le.useStore)(e=>e.skipMinutes),St=(0,le.useStore)(e=>e.clock.mode),Ct=(0,le.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Rt=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,Ne.workingShifts)(Rt,Bt),[Rt,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Wt=(0,$.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:lt(Tt.find(e=>e.id===Wt)?.name)}),Ht=I.IS_CAR?'Car':'Display';(0,L.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,ne.useFrontDoor)(Pt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Ft=(0,re.useFloor)(e=>e.live[jt]),Gt=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,el]=(0,H.useState)(null),[tl,ll]=(0,H.useState)(null),[sl,il]=(0,H.useState)(!1),[ol,nl]=(0,H.useState)(!1),[al,rl]=(0,H.useState)(null),[dl,cl]=(0,H.useState)(!1),[ul,hl]=(0,H.useState)(!1),[gl,bl]=(0,H.useState)(!1),[yl,pl]=(0,H.useState)(null),[fl,xl]=(0,H.useState)(null),[ml,jl]=(0,H.useState)(null),[wl,kl]=(0,H.useState)(!1),Il=P.default.useRef(0),Dl=e=>{Il.current=Date.now(),jl(e)};P.default.useEffect(()=>{if(!ml)return;const e=setInterval(()=>{Date.now()-Il.current>=He.DAY_IDLE_MS&&jl(null)},5e3);return()=>clearInterval(e)},[ml]);const vl=(0,le.useWaitlist)(jt),Sl=(0,le.useStore)(e=>e.walkIns[jt]??0),[Cl,Tl]=(0,H.useState)(!1),[$l,Rl]=(0,H.useState)(!1),[Bl,Ll]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Wl,zl]=(0,H.useState)({view:0,content:0}),[Hl,Pl]=(0,H.useState)(null);P.default.useEffect(()=>{Hl&&((0,W.notify)({id:`floor-note:${Date.now()}`,title:Hl,timeoutMs:4500,big:!0,testID:'floor-toast'}),Pl(null))},[Hl]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Ml,Al]=(0,H.useState)(null),El=P.default.useRef(0),[Ol,Nl]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ml)return;El.current=Date.now();const e=setInterval(()=>{const e=Date.now()-El.current;if(e>=Xe)return Al(null),void Pl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nl(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ml]);const _l=e=>e.date!==Pt?ll({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!ci.ok,accessibilityHint:ci.hint,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ll({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ll(null),rl(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ll(null),Pl(e)}}):null,e.walkIn?(0,Ye.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ll(null),Pl(e)}}):null,(0,Se.bookingDetails)(e)]})}),Fl=It.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),Gl=Fl.filter(e=>!['cancelled','noshow'].includes(e.status)),Vl=kt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ul=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),Kl=(0,Be.closedAreasAt)(Gt,jt,Pt,(0,te.hm)(Ct)),ql=[...Kl].join(','),Yl=(0,H.useMemo)(()=>(0,de.floorView)(_t,It,kt,Ft??{},Ct,wt.settings.turnMins,Kl),[_t,It,kt,Ft,Ct.getTime(),ql]),Ql=(0,ve.hoursFor)(wt,Ct),Jl=Ql?.open??new Date(`${Pt}T12:00:00`),Xl=Ql?.close??new Date(`${Pt}T21:00:00`),Zl=(0,te.addMins)(Jl,-Jl.getMinutes()),es=(0,te.addMins)(Xl,30),ts=e=>new Date(`${Pt}T${e}:00`),ls=(0,Be.blocksOn)(Gt,jt,Pt).map(e=>({from:ts(e.from),to:ts(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Pt)),ss=Object.keys(Yl).filter(e=>'blocked'===Yl[e]?.status),is=ml&&ml!==Pt?ml:Pt,os=is!==Pt,ns=(0,He.dayWord)(is,Pt),as=/^(Today|Yesterday|Tomorrow)$/.test(ns),rs=os?(0,He.bookingsForDay)(It,is,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Fl,ds=(0,te.parseYmd)(is);ds.setHours(12);const cs=os?(0,ve.hoursFor)(wt,ds):Ql,us=cs?.open??new Date(`${is}T12:00:00`),hs=cs?.close??new Date(`${is}T21:00:00`),gs=e=>new Date(`${is}T${e}:00`),bs=[...os?(0,Be.blocksOn)(Gt,jt,is).map(e=>({from:gs(e.from),to:gs(e.to),label:e.reason??'Paused'})):ls,...os?(0,o.queuedServicePauses)(wt,ds,is):[]],ys=(0,o.queuedServiceSessions)(wt,ds),ps=s.IS_QUEUED_VENUE&&(void 0===ys||!ys.length),fs=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ys?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),xs=os?cs||rs.length?isos?(0,de.dayFloorView)(_t,rs,is):Yl,[os,_t,rs,is,Yl]),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),[Ss,Cs]=(0,H.useState)(null),Ts=os?rs.filter(e=>!['cancelled','noshow'].includes(e.status)):Gl,$s=Ts.reduce((e,t)=>e+t.partySize,0),Rs=(0,u.coversSplit)(Ts,is),Bs=(0,Me.cancelledDayTally)(It,is),Ls=(0,Ae.cancellationsFor)(It,is,e=>e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Ws=(0,Me.cancelledTallyWords)(Bs,as?ns.toLowerCase():os?`on ${ns}`:'today'),zs=Gt.filter(e=>e.rid===jt&&e.date===is&&!e.removedAt),Hs=(0,ze.chartBands)(zs,60*us.getHours()+us.getMinutes(),60*hs.getHours()+hs.getMinutes()),Ps=new Set((0,ze.blockedHours)(Hs)),Ms=Ct.getHours()+(Ct.getMinutes()>=30?1:0),As=Ul.hours.filter(e=>e.hour>=Ms&&!Ps.has(e.hour)),Es=As.reduce((e,t)=>e+t.coversHigh,0),Os=As.reduce((e,t)=>e+t.coversLow,0),Ns=Math.round((Os+Es)/2),_s=!Ul.example&&Ul.open&&Ul.enough&&Es>0?`Usually ${(0,c.coversRange)(Ns,Ns)} more`:void 0,Fs=async(e,t)=>{const l=Yl[e]?.booking;if(!l||e===t)return;const s=Yl[t]?.status;if(s&&!['free','soon'].includes(s))return void Pl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Pl,{b:l,tables:[t]}))return;await le.repo.bookings.update(l.id,{table:t});const i=Ft?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Pl(`Saving: ${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(l.id,`${(0,xe.privName)(l,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(l,Ot)} to ${(0,d.tableNumbers)(t)}`,Pl)},Gs=e=>{if(fl)return Is(null),void xl(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);os?ws(e):Zt?(e!==Zt&&Fs(Zt,e),el(null)):Xt(e)},Vs=fl?It.find(e=>e.id===fl.id):void 0,Us=fl&&Vs?(()=>{const e=Vs.walkIn?(0,xe.privName)(Vs,Ot):lt(Vs.name),t=(0,De.seatsOf)(_t,fl.tables).total,l=(0,De.seatLine)(t,Vs.partySize),s=(0,De.pickClashes)(Vs,fl.tables,It.filter(e=>e.date===Vs.date),wt.settings.turnMins),i=(0,De.tableKey)(fl.tables)!==(0,De.tableKey)((0,re.tablesOf)(Vs.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(Vs.date,Pt)} ${Vs.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(fl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(Vs.date,Pt)," ",Vs.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:se.colours.text,children:[(0,De.tablesWords)(fl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ks?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ks,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ks})}):null,Ds&&Vs&&fl.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,fl.tables.join('+')),onYes:()=>{vs(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,l,e,t,Pl)})()},onNo:()=>vs(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:ks?'plan-pick-overcap-yes':'plan-pick-save',label:ks?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ks?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(fl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Vs)return void xl(null);if(!(0,Ie.guardBookingChange)(Pl,{b:Vs,tables:fl.tables}))return Is(null),void xl(null);const l=(0,De.overCapacityAsk)(fl.tables,t,Vs.partySize);if(l&&!ks)return void Is(l);if('finished'===Vs.status&&fl.tables.length&&!Ds)return void vs(!0);Is(null),vs(!1);const s=fl.tables;xl(null),await(0,Ie.saveTablesReported)(jt,Vs,s,e,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Is(null),xl(null)}})]})]})})():null,Ks=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),qs=e=>{const t=_t.tables.filter(t=>t.areaId===e);return os?`${t.filter(e=>!ms[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Yl[e.name]?.status??'free')).length}/${t.length} free`},Ys='all'===Yt||Ks.some(e=>e.id===Yt)?Yt:'all',Qs=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:ms,privacy:Ot,turnBase:wt.settings.turnMins,highlight:fl?fl.tables:Zt?[Zt]:void 0,onTap:e=>Gs(e.name),onDrop:(e,t)=>fl||os?void 0:Fs(e.name,t.name)}),Js=ut?1:ht||Ks.length>2?2:1,Xs=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=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)/l},Zs=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ti=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:qs(e.id)})]}),li=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(l-xt.h)>1)&&mt({w:t,h:l})},children:ei?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:ei.scroll,showsVerticalScrollIndicator:ei.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:ei.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:ei.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=Ks.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ei.cellW,gap:2},children:[ti(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:Qs(e)})]},e)})},t))}):null}),si=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Ys,onPress:()=>Qt('all')},"__all"),...Ks.map(e=>(0,Ye.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ut?Kl.has(e.id)?'closed':Ys===e.id?qs(e.id):void 0:void 0,selected:Ys===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;zl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>zl(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:Wl.view>0&&Wl.content>0&&Wl.content<=Wl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Wl.view>0&&Wl.content<=Wl.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),Us,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>el(null)})]}):null,'all'===Ys&>?li:'all'===Ys?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:Zs.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>Xs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:qs(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Kl.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:qs(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*Xs(e.id)))}:{flex:1},children:Qs(e.id)})]},e.id)),e.length{if(os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},is)}),oi='timeline'===Vt,ni=Kt?(0,Ye.jsx)(F.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${os?(0,He.dayLong)(is):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),ps?fs:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:os?rs:Fl,now:os?us:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:os?(0,te.addMins)(us,-us.getMinutes()):Zl,t1:os?(0,te.addMins)(hs,30):es,pauses:os?bs:ls,blockedTables:os?[]:ss,onOpen:e=>{if(qt(!1),os)return void pl(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Yl[t]?Xt(t):_l(e)}},`full-${is}`)})]})}):null,ai=os?(0,Ye.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:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:as?`Showing ${ns} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(is))}`:`Showing ${(0,He.dayWord)(is,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ws}. Showing ${(0,He.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{xl(null),Dl(null)},style:{minHeight:44}})]}):null,ri=(0,Ye.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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(oi||Kt);return(0,Ye.jsx)(V.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.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,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),di='display'===I.APP_VARIANT&&!e?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ri,(0,Ye.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:Rt,staff:Tt,today:Pt,leave:Bt})]}):ri,ci=(0,h.useBookingWrite)(),ui=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint}),(0,Ye.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>nl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ci.ok,accessibilityHint:ci.hint})]});(0,qe.useDisplayNotices)(jt,!e);const hi=ut?180:168,[gi,bi]=(0,H.useState)(hi),yi=P.default.useRef(hi),pi=P.default.useRef(null),fi=P.default.useRef(null),xi=()=>{const e=pi.current,t=fi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=ct<820?8:12,o=44+(ct<820?4:8),n=i>yi.current?Math.ceil(i-yi.current):We.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(hi,Math.floor(t-s-l)-n-o));Math.abs(yi.current-a)>=2&&(yi.current=a,bi(a))})})};P.default.useEffect(()=>{const e=setTimeout(xi,60);return()=>clearTimeout(e)},[rt,ct]);const mi=(0,Ye.jsxs)(K.default,{ref:fi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),xi()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Nl(null),Al({at:Date.now()})},onHint:()=>Pl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(Le.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:is}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(Le.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ll(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),ji=Vl.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:se.colours.muted,children:[Vl.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Vl,me:zt,compact:!0,bookings:It})})]}):null,wi=(Oe.DueToday,wt.settings.turnMins||90),ki=os?rs:(0,v.todaysGuestList)(Fl,Ct,wi),Ii=os?[]:(0,v.todaysFinishedList)(Fl,Ct,wi),Di=os?as?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',vi=(0,Ye.jsxs)(Ye.Fragment,{children:[0===ki.length?(0,Ye.jsx)(Q.Muted,{children:os?is{const t=(0,v.isLeftEarly)(e,Ct,wi),l=(0,ie.isSeatedHighlight)(e.status,{otherDay:os})&&!t,s=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=se.colours.text,o=l?se.colours.goldLight:se.colours.muted,n=se.colours.gold,a=s.depositWarn?se.colours.amber:se.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:os?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(_.AllergyIcon,{text:s.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,s.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ii.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ii.length}${gl?', expanded':', collapsed'}`,accessibilityState:{expanded:gl},onPress:()=>bl(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ii.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:se.colours.muted,children:gl?'\u25be':'\u25b8'})]}),gl?Ii.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{hl(!1),pl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:ci.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Ee.CancellationsSection,{items:Ls,dayWord:os?as?ns.toLowerCase():`on ${ns}`:'today'})]}),Si=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:vi}),Ci=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&hl(!1)}}),Ti=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Di}, ${ki.length}`,accessibilityState:{expanded:ul},'aria-expanded':ul,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:ul?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:ul?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:se.colours.gold,children:ki.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Di," ",ul?'\u2039':'\u203a']})})})]}),$i=ul?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...Ci.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Di.toUpperCase()," (",ki.length,")"]}),(0,Ye.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Di}`,onPress:()=>hl(!1),style:{marginRight:-6}})]}),Bs.count?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Ws}):null]}),Si]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Di}`,accessibilityRole:"button",onPress:()=>hl(!1),style:{flex:1}})]}):null,Ri=ps?fs:s.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:rs,open:us,close:hs,now:Ct,turnBase:wt.settings.turnMins,blocks:zs,pauses:bs,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:hi,forecastNote:os?void 0:_s,emptyText:xs,past:is{Il.current=Date.now(),kl(!0)},shortDay:!ut&&rt<1100}),Wi=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:wl,today:Pt,day:is,bookings:It,restaurant:wt,now:Ct,onDay:Dl,onClose:()=>kl(!1)}),zi=()=>{os?hl(!0):qt(!0)},Hi=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ct<820?8:12,paddingTop:ct<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[Mt?null:Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:ai,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):oi?ii:si,ni,$i]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ui(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:di}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:ct<820,snug:ct<820,tight:ct<700,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{ref:pi,testID:"day-graph-slot",onLayout:xi,style:{flexGrow:0,flexShrink:1,flexBasis:hi+52,minHeight:ct<=600?90:120,overflow:'visible'},children:Bi}),(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),ji,(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Il.current=Date.now()},onMouseDown:()=>{Il.current=Date.now()},children:[ut?(0,Ye.jsxs)(K.default,{style:{flex:1},children:[(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt}),Li,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(ot,{phone:!0,split:Rs,items:[{label:`Tables \xb7 ${ns}`,value:Ts.length,testID:'badge-tables'},{label:`Covers \xb7 ${ns}`,value:$s,testID:'badge-covers'},{label:'Takeaway',value:Vl.length,alert:Vl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>il(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ui(!0)}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),di,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[oi?ii:si,ni]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Di," (",ki.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Di,style:{gap:4},children:vi})]}),ji,Bi,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Rl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),mi]}),e?null:(0,Ye.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:se.colours.hairline},children:(0,Ye.jsx)(N.VoiceSlot,{size:56})})]}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ct<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ye.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:se.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Li}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Ge.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Ge.SundayRoastChip,{rid:jt,by:zt,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,Ye.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:se.colours.muted,children:"?"})}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,e?null:(0,Ye.jsx)(j.ExitButton,{}),ee,Ue?null:(0,Ye.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,!I.IS_CAR&&Mt?(0,Ye.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ye.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(ot,{splitOnly:!0,split:Rs,items:[]})})]})}),gt?Hi:(Pi=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ui(!1)}),di]}),(0,Ye.jsx)(Le.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ti,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[ai,oi?ii:si,ni,$i]})]})}),ji,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:is,sound:(0,E.flapSoundOn)(),onPress:zi})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:hi+We.DAY_GRAPH_CHROME},children:Bi})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Pi})),mi]}),(0,Ye.jsx)(R.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ll(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Bl,onClose:()=>Ll(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ol?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>nl(!1)}):null,al?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:al,who:zt,onClose:()=>rl(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Yl,plan:_t,todays:Fl,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>el(e),onDetails:_l}):null,js?(()=>{const e=ms[js],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Cs(null),ws(null)},title:`${(0,d.tableNumbersA11y)(js)} \xb7 ${as?ns:(0,He.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${as?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${as?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Ot):lt(e.name);return(0,Ye.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ws(null),pl(e.id)},style:{minHeight:56}},e.id)}),is>=Pt?(()=>{const t=e?.table.maxSeats??0,l=It.filter(e=>e.date===is&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(js)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(js)]}),Ss?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Ss.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Ss.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ci.ok,accessibilityHint:ci.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Ss.id);if(Cs(null),!e)return;const l=lt(e.name);ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Cs(null)})]})]}):null,Ss?null:l.slice(0,12).map(e=>{const l=lt(e.name),s=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ci.ok,accessibilityHint:ci.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(js)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Pl,{b:e,tables:[js]}))return;const s=(0,De.overCapacityAsk)([js],t,e.partySize);s?Cs({id:e.id,ask:s}):(ws(null),await(0,Ie.saveTablesReported)(jt,e,[js],l,t,Pl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Cs(null),ws(null)},style:{minHeight:56}})]})})():null,yl?(()=>{const e=It.find(e=>e.id===yl);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Ot):lt(e.name),view:Yl,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>pl(null),onDetails:_l,onDone:Pl,onEdit:e=>{pl(null),rl(e.id)},onPickOnPlan:(e,t)=>{hl(!1),Ut('plan'),Qt('all'),xl({id:e.id,tables:t})}}):null})():null,tl?(0,Ye.jsx)(Se.DetailsPanel,{title:tl.title,onClose:()=>ll(null),children:tl.body}):null,Wi,dl?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Fl,orders:kt,waitlistAll:vl,walkInCount:Sl,onClose:()=>cl(!1)}):null,Cl?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Tl(!1)})]}):null,$l?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Rl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Rl(!1)})]}):null,sl?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>il(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Vl,me:zt,bookings:It})]}):null,Ml?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{El.current=Date.now(),null!==Ol&&Nl(null)},notice:null!==Ol?`Locking again in ${Ol} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Al(null),Pl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Pl('Live seating plan updated on every screen.')},onCancel:()=>{Al(null),Pl('No changes kept. Editing is locked again.')}},Ml.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)($e.TakeawayTakeover,{rid:jt,me:zt})]});var Pi}function dt({rid:e,id:t,turnBase:l}){const s=(0,le.useBookings)(e).find(e=>e.id===t);return s?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1340,[1069,797,5,6,1341,829,854,1108,861,1155,1342,1343,1344,1105,1135,1345,1346,1351,1352,1215,1353,873,1358,1359,1360,1128,1127,977,1361,1167,950,1118,1362,35,1088,1189,1027,1101,1151,1363,396,381,403,296,103,427,37,795,1238,1242,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1364,1122,1365,1372,1374,1377,1382,1376,1383,1385,1386,1130,1109,1110,879,1391,1227,1392,1237,1229,1004,1397,1402,1403,1070,1068,1132,1405,1406,1407,1087,1182,1408,1181,1174,870,1354,1409,26]); +__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 Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,qe.jsx)(rt,{...e}):(0,qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Q.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]),o=_r(_d[4]),n=_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]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_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]),H=_r(_d[32]),z=_r(_d[33]),M=e(z),P=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_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])),Y=e(_r(_d[45])),q=_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]),oe=_r(_d[56]),ne=_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]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_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]),He=_r(_d[85]),ze=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_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]),Ye=_r(_d[99]),qe=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){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:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?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)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,qe.jsx)(Q.T,{size:s?14:12,colour:le.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)(M.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||o?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)(Q.T,{size:14,colour:le.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)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Q.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:le.colours.gold},children:[(0,qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){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:n?4:7,minHeight:44,paddingHorizontal:n?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:[o?(0,qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,qe.jsx)(Q.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.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:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,qe.jsx)(Q.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)(Q.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)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,Y.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=M.default.useRef(null),xt=M.default.useRef(0),[ft,mt]=(0,z.useState)({w:0,h:0}),jt=(0,oe.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const kt=(0,se.useOrders)(jt),It=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,oe.useOwner)(e=>e.staff),Rt=(0,oe.useOwner)(e=>e.attendance),$t=(0,oe.useOwner)(e=>e.shifts),Bt=(0,oe.useOwner)(e=>e.leave),Wt=M.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);M.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Mt=(0,te.ymd)(Ct),Pt=(0,A.useTravelDay)('display',Mt),At=(0,ne.useFrontDoor)(Mt,ht),Et=(0,re.useDisplaySettings)(jt),Ot=Et.privacy,Nt=(0,xe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,z.useState)('plan'),[Kt,Yt]=(0,z.useState)(!1),[qt,Qt]=(0,z.useState)('all'),[Jt,Xt]=(0,z.useState)(null),[Zt,es]=(0,z.useState)(null),[ts,ss]=(0,z.useState)(null),[ls,is]=(0,z.useState)(!1),[os,ns]=(0,z.useState)(!1),[as,rs]=(0,z.useState)(null),[ds,cs]=(0,z.useState)(!1),[us,hs]=(0,z.useState)(!1),[gs,bs]=(0,z.useState)(!1),[ys,ps]=(0,z.useState)(null),[xs,fs]=(0,z.useState)(null),[ms,js]=(0,z.useState)(null),[ws,ks]=(0,z.useState)(!1),Is=M.default.useRef(0),Ds=e=>{Is.current=Date.now(),js(e)};M.default.useEffect(()=>{if(!ms)return;const e=setInterval(()=>{Date.now()-Is.current>=ze.DAY_IDLE_MS&&js(null)},5e3);return()=>clearInterval(e)},[ms]);const vs=(0,se.useWaitlist)(jt),Ss=(0,se.useStore)(e=>e.walkIns[jt]??0),[Cs,Ts]=(0,z.useState)(!1),[Rs,$s]=(0,z.useState)(!1),[Bs,Ws]=(0,z.useState)(!1),[Ls,Hs]=(0,z.useState)(!1);(0,X.useReviewAlerts)(jt);const[zs,Ms]=(0,z.useState)({view:0,content:0}),[Ps,As]=(0,z.useState)(null);M.default.useEffect(()=>{Ps&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Ps,timeoutMs:4500,big:!0,testID:'floor-toast'}),As(null))},[Ps]),M.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Es,Os]=(0,z.useState)(null),Ns=M.default.useRef(0),[_s,Gs]=(0,z.useState)(null);M.default.useEffect(()=>{if(!Es)return;Ns.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Ns.current;if(e>=Xe)return Os(null),void As('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Gs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Fs=e=>e.date!==Mt?ss({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Mt)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!hi.ok,accessibilityHint:hi.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(ke.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),As(e)}}):null,e.walkIn?(0,qe.jsx)(ke.ReinstateWalkInButton,{rid:jt,b:e,today:Mt,onDone:e=>{ss(null),As(e)}}):null,(0,Se.bookingDetails)(e)]})}),Vs=It.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Us=Vs.filter(e=>!['cancelled','noshow'].includes(e.status)),Ks=kt.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,z.useMemo)(()=>(0,c.forecastToday)(wt,It,kt,Dt,Ct),[wt,It,kt,Dt,Ct.getTime()/6e4|0]),qs=(0,Be.closedAreasAt)(Ft,jt,Mt,(0,te.hm)(Ct)),Qs=[...qs].join(','),Js=(0,z.useMemo)(()=>(0,de.floorView)(_t,It,kt,Gt??{},Ct,wt.settings.turnMins,qs),[_t,It,kt,Gt,Ct.getTime(),Qs]),Xs=(0,ve.hoursFor)(wt,Ct),Zs=Xs?.open??new Date(`${Mt}T12:00:00`),el=Xs?.close??new Date(`${Mt}T21:00:00`),tl=(0,te.addMins)(Zs,-Zs.getMinutes()),sl=(0,te.addMins)(el,30),ll=e=>new Date(`${Mt}T${e}:00`),il=(0,Be.blocksOn)(Ft,jt,Mt).map(e=>({from:ll(e.from),to:ll(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(wt,Ct,Mt)),ol=Object.keys(Js).filter(e=>'blocked'===Js[e]?.status),nl=ms&&ms!==Mt?ms:Mt,al=nl!==Mt,rl=(0,ze.dayWord)(nl,Mt),dl=/^(Today|Yesterday|Tomorrow)$/.test(rl),cl=al?(0,ze.bookingsForDay)(It,nl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):Vs,ul=(0,te.parseYmd)(nl);ul.setHours(12);const hl=al?(0,ve.hoursFor)(wt,ul):Xs,gl=hl?.open??new Date(`${nl}T12:00:00`),bl=hl?.close??new Date(`${nl}T21:00:00`),yl=e=>new Date(`${nl}T${e}:00`),pl=[...al?(0,Be.blocksOn)(Ft,jt,nl).map(e=>({from:yl(e.from),to:yl(e.to),label:e.reason??'Paused'})):il,...al?(0,o.queuedServicePauses)(wt,ul,nl):[]],xl=(0,o.queuedServiceSessions)(wt,ul),fl=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),ml=(0,qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),jl=al?hl||cl.length?nlal?(0,de.dayFloorView)(_t,cl,nl):Js,[al,_t,cl,nl,Js]),[kl,Il]=(0,z.useState)(null),[Dl,vl]=(0,z.useState)(null),[Sl,Cl]=(0,z.useState)(!1),[Tl,Rl]=(0,z.useState)(null),$l=al?cl.filter(e=>!['cancelled','noshow'].includes(e.status)):Us,Bl=$l.reduce((e,t)=>e+t.partySize,0),Wl=(0,u.coversSplit)($l,nl),Ll=(0,Pe.cancelledDayTally)(It,nl),Hl=(0,Ae.cancellationsFor)(It,nl,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),zl=(0,Pe.cancelledTallyWords)(Ll,dl?rl.toLowerCase():al?`on ${rl}`:'today'),Ml=Ft.filter(e=>e.rid===jt&&e.date===nl&&!e.removedAt),Pl=(0,He.chartBands)(Ml,60*gl.getHours()+gl.getMinutes(),60*bl.getHours()+bl.getMinutes()),Al=new Set((0,He.blockedHours)(Pl)),El=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Ol=Ys.hours.filter(e=>e.hour>=El&&!Al.has(e.hour)),Nl=Ol.reduce((e,t)=>e+t.coversHigh,0),_l=Ol.reduce((e,t)=>e+t.coversLow,0),Gl=Math.round((_l+Nl)/2),Fl=!Ys.example&&Ys.open&&Ys.enough&&Nl>0?`Usually ${(0,c.coversRange)(Gl,Gl)} more`:void 0,Vl=async(e,t)=>{const s=Js[e]?.booking;if(!s||e===t)return;const l=Js[t]?.status;if(l&&!['free','soon'].includes(l))return void As('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(As,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),As(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,As)},Ul=e=>{if(xs)return vl(null),void fs(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);al?Il(e):Zt?(e!==Zt&&Vl(Zt,e),es(null)):Xt(e)},Kl=xs?It.find(e=>e.id===xs.id):void 0,Yl=xs&&Kl?(()=>{const e=Kl.walkIn?(0,fe.privName)(Kl,Ot):st(Kl.name),t=(0,De.seatsOf)(_t,xs.tables).total,s=(0,De.seatLine)(t,Kl.partySize),l=(0,De.pickClashes)(Kl,xs.tables,It.filter(e=>e.date===Kl.date),wt.settings.turnMins),i=(0,De.tableKey)(xs.tables)!==(0,De.tableKey)((0,re.tablesOf)(Kl.table));return(0,qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Kl.date,Mt)} ${Kl.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Kl.date,Mt)," ",Kl.time]}),(0,qe.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Dl?(0,qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Dl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,qe.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Dl})}):null,Sl&&Kl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Cl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,s,e,t,As)})()},onNo:()=>Cl(!1)}):null,(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:Dl?'plan-pick-overcap-yes':'plan-pick-save',label:Dl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Dl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Kl)return void fs(null);if(!(0,Ie.guardBookingChange)(As,{b:Kl,tables:xs.tables}))return vl(null),void fs(null);const s=(0,De.overCapacityAsk)(xs.tables,t,Kl.partySize);if(s&&!Dl)return void vl(s);if('finished'===Kl.status&&xs.tables.length&&!Sl)return void Cl(!0);vl(null),Cl(!1);const l=xs.tables;fs(null),await(0,Ie.saveTablesReported)(jt,Kl,l,e,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),fs(null)}})]})]})})():null,ql=_t.areas.filter(e=>_t.tables.some(t=>t.areaId===e.id)),Ql=e=>{const t=_t.tables.filter(t=>t.areaId===e);return al?`${t.filter(e=>!wl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Js[e.name]?.status??'free')).length}/${t.length} free`},Jl='all'===qt||ql.some(e=>e.id===qt)?qt:'all',Xl=e=>(0,qe.jsx)(ce.FloorCanvas,{plan:_t,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:wl,privacy:Ot,turnBase:wt.settings.turnMins,highlight:xs?xs.tables:Zt?[Zt]:void 0,onTap:e=>Ul(e.name),onDrop:(e,t)=>xs||al?void 0:Vl(e.name,t.name)}),Zl=ut?1:ht||ql.length>2?2:1,ei=e=>{const t=_t.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},ti=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),ft.w,ft.h):null,li=e=>(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:Ql(e.id)})]}),ii=(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-ft.w)>1||Math.abs(s-ft.h)>1)&&mt({w:t,h:s})},children:si?(0,qe.jsx)(U.default,{style:{flex:1},scrollEnabled:si.scroll,showsVerticalScrollIndicator:si.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:si.rows.map((e,t)=>(0,qe.jsx)(K.default,{style:{height:si.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=ql.find(t=>t.id===e);return(0,qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:si.cellW,gap:2},children:[li(t),(0,qe.jsx)(K.default,{style:{flex:1},children:Xl(e)})]},e)})},t))}):null}),oi=(0,qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:_t}),_t.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)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Q.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)(Q.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)(nt,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===Jl,onPress:()=>Qt('all')},"__all"),...ql.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?qs.has(e.id)?'closed':Jl===e.id?Ql(e.id):void 0:void 0,selected:Jl===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(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;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(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:zs.view>0&&zs.content>0&&zs.content<=zs.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:zs.view>0&&zs.content<=zs.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),Yl,Zt?(0,qe.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,qe.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===Jl&>?ii:'all'===Jl?(0,qe.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ti.map((e,t)=>(0,qe.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ei(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{center:!0,children:Ql(e.id)})]}):(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),qs.has(e.id)?(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Q.Muted,{children:Ql(e.id)})]}),(0,qe.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ei(e.id)))}:{flex:1},children:Xl(e.id)})]},e.id)),e.length{if(al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},nl)}),ai='timeline'===Vt,ri=Kt?(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:le.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:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.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)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${al?(0,ze.dayLong)(nl):'Today'}`})}),rt<600?null:(0,qe.jsx)(K.default,{style:{minWidth:180}})]}),fl?ml:(0,qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(ye.Timeline,{hideNow:!0,fit:!0,plan:_t,bookings:al?cl:Vs,now:al?gl:Ct,privacy:Ot,turnBase:wt.settings.turnMins,t0:al?(0,te.addMins)(gl,-gl.getMinutes()):tl,t1:al?(0,te.addMins)(bl,30):sl,pauses:al?pl:il,blockedTables:al?[]:ol,onOpen:e=>{if(Yt(!1),al)return void ps(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Js[t]?Xt(t):Fs(e)}},`full-${nl}`)})]})}):null,di=al?(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:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:dl?`Showing ${rl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(nl))}`:`Showing ${(0,ze.dayWord)(nl,Mt)}`}),(0,qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${zl}. Showing ${(0,ze.dayLong)(nl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{fs(null),Ds(null)},style:{minHeight:44}})]}):null,ci=(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:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(ai||Kt);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?(Ut('plan'),Yt(!0)):(Yt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.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)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ui='display'===I.APP_VARIANT&&!e?(0,qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut?'nowrap':'wrap',gap:6,alignItems:ut?'stretch':'center'},children:[ci,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ut,shifts:$t,staff:Tt,today:Mt,leave:Bt})]}):ci,hi=(0,h.useBookingWrite)(),gi=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint}),(0,qe.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!hi.ok,accessibilityHint:hi.hint})]});(0,Ye.useDisplayNotices)(jt,!e);const bi=!e&&!I.IS_CAR&&!ut,yi=ut?180:202,[pi,xi]=(0,z.useState)(ut?180:168),fi=M.default.useRef(ut?180:168),mi=M.default.useRef(null),ji=M.default.useRef(null),wi=M.default.useRef(null),ki=!ut&&ct<=800,Ii=()=>{const e=mi.current,t=ji.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l)=>{const i=t>fi.current?Math.ceil(t-fi.current):0,o=Math.max(Le.DAY_GRAPH_CHROME+(ki?24:8),i),n=!ut&&ct>=700?140:70,a=Math.floor(s-4-e)-o-l,r=Math.min(yi,a>=n?Math.max(n,a):Math.max(0,a));Math.abs(fi.current-r)>=2&&(fi.current=r,xi(r))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,o,n,a)=>{t.measureInWindow((e,t)=>{const n=wi.current;bi&&n?.measureInWindow?n.measureInWindow((e,l,n,r)=>{const d=ct<820?4:8;s(o,a,t,Math.max(i,44+d+Math.round(r||0)))}):s(o,a,t,bi?i:l)})})};M.default.useEffect(()=>{const e=setTimeout(Ii,60);return()=>clearTimeout(e)},[rt,ct]);const Di=(0,qe.jsxs)(K.default,{ref:ji,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ii()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:ki?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ke.DisplayClockButton,{}),(0,qe.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Gs(null),Os({at:Date.now()})},onHint:()=>As('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:Ht,quiet:!0,display:!0,day:nl}),_t.areas.some(e=>e.outdoor)?(0,qe.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,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:()=>Hs(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(x.GiftQrButton,{rid:jt,venue:wt.name})]}),vi=Ks.length?(0,qe.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ks.length," live"]})]}),(0,qe.jsx)(K.default,{style:{padding:10},children:(0,qe.jsx)(at,{list:Ks,me:Ht,compact:!0,bookings:It})})]}):null,Si=(Oe.DueToday,wt.settings.turnMins||90),Ci=al?cl:(0,v.todaysGuestList)(Vs,Ct,Si),Ti=al?[]:(0,v.todaysFinishedList)(Vs,Ct,Si),Ri=al?dl?`${rl}\u2019s guests`:`Guests ${rl}`:'Today\u2019s guests',$i=(0,qe.jsxs)(qe.Fragment,{children:[0===Ci.length?(0,qe.jsx)(Q.Muted,{children:al?nl{const t=(0,v.isLeftEarly)(e,Ct,Si),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:al})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,o=s?le.colours.goldLight:le.colours.muted,n=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:al?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:l.time}),(0,qe.jsx)(Q.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)(_.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Q.T,{size:16,colour:o,children:" \xb7 "}),(0,qe.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?o:i,children:l.table}),l.dog?(0,qe.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),Ti.length?(0,qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ti.length}${gs?', expanded':', collapsed'}`,accessibilityState:{expanded:gs},onPress:()=>bs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",Ti.length,")"]}),(0,qe.jsx)(Q.T,{size:16,colour:le.colours.muted,children:gs?'\u25be':'\u25b8'})]}),gs?Ti.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(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:()=>{hs(!1),ps(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Q.T,{size:15,colour:le.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:jt,today:Mt,who:t.name,allowed:hi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ee.CancellationsSection,{items:Hl,dayWord:al?dl?rl.toLowerCase():`on ${rl}`:'today'})]}),Bi=(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:$i}),Wi=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&&hs(!1)}}),Li=(0,qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ri}, ${Ci.length}`,accessibilityState:{expanded:us},'aria-expanded':us,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>hs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:Ci.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)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[Ri," ",us?'\u2039':'\u203a']})})})]}),Hi=us?(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",...Wi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.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,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Ri.toUpperCase()," (",Ci.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Ri}`,onPress:()=>hs(!1),style:{marginRight:-6}})]}),Ll.count?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:zl}):null]}),Bi]}),(0,qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ri}`,accessibilityRole:"button",onPress:()=>hs(!1),style:{flex:1}})]}):null,zi=fl?ml:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,It,Ct).busy,todays:cl,open:gl,close:bl,now:Ct,turnBase:wt.settings.turnMins,blocks:Ml,pauses:pl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?pi:yi,forecastNote:al?void 0:Fl,emptyText:jl,past:nl{Is.current=Date.now(),ks(!0)},shortDay:!ut&&rt<1100}),Ai=(0,qe.jsx)(Me.DisplayCalendar,{visible:ws,today:Mt,day:nl,bookings:It,restaurant:wt,now:Ct,onDay:Ds,onClose:()=>ks(!1)}),Ei=()=>{al?hs(!0):Yt(!0)},Oi=(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:ki?4:ct<820?8:12,paddingTop:ki?bi?2:4:ct<820?bi?4:6:bi?8:10,gap:ki?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:di,Pt?(0,qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,today:Mt,app:"display"})}):ai?ni:oi,ri,Hi]}),(0,qe.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:gi(!1)}),(0,qe.jsx)(K.default,{style:{flexShrink:0},children:ui}),Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:ct<820,snug:ct<820,tight:ct<800,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{ref:mi,testID:"day-graph-slot",onLayout:Ii,style:{flexGrow:0,flexShrink:1,flexBasis:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),height:(ut?yi:pi)+Le.DAY_GRAPH_CHROME+(ki?24:8),minHeight:ct<=600?90:Math.min((ut?yi:pi)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:Mi}),(0,qe.jsxs)(U.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[bi?null:(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),vi,(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht})]}),bi&&!Pt?(0,qe.jsx)(K.default,{ref:wi,testID:"display-side-split",style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})}):null]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{Is.current=Date.now()},onMouseDown:()=>{Is.current=Date.now()},children:[ut?(0,qe.jsxs)(K.default,{style:{flex:1},children:[(0,qe.jsxs)(U.default,{ref:pt,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)(Z.RestaurantLogo,{rid:jt,size:64}),(0,qe.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,qe.jsx)(Z.PoweredBy,{}),(0,qe.jsx)(H.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,qe.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:"m"}),(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:"m"}),ee]}),Ve,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt}),Pi,(0,qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(ot,{phone:!0,split:Wl,items:[{label:`Tables \xb7 ${rl}`,value:$l.length,testID:'badge-tables'},{label:`Covers \xb7 ${rl}`,value:Bl,testID:'badge-covers'},{label:'Takeaway',value:Ks.length,alert:Ks.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:gi(!0)}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),ui,(0,qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ai?ni:oi,ri]}),(0,qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[Ri," (",Ci.length,")"]}),(0,qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:Ri,style:{gap:4},children:$i})]}),vi,Mi,(0,qe.jsx)(K.default,{testID:"covers-dock",children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>pt.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)(Q.T,{center:!0,size:14,colour:Ot?le.colours.muted:le.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,qe.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Di]}),e?null:(0,qe.jsx)(K.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:le.colours.hairline},children:(0,qe.jsx)(N.VoiceSlot,{size:56})})]}):(0,qe.jsxs)(qe.Fragment,{children:[bi?(0,qe.jsxs)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,n.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.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})}),(0,qe.jsx)(V.default,{testID:"display-more",accessibilityRole:"button",accessibilityLabel:"More",onPress:()=>Ws(!0),style:({pressed:e})=>({minWidth:44,height:44,marginLeft:8,paddingHorizontal:10,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center',flexShrink:0}),children:(0,qe.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.muted,children:"More"})})]}):null,(0,qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:ki?2:ct<820?4:8,gap:8,minHeight:ki&&bi?44:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,qe.jsx)(K.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0})}),(0,qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,qe.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Pt?(0,qe.jsx)(K.default,{style:{width:220}}):(0,qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Pi}),(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:rt>=1400?'row':'column',alignItems:rt>=1400?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Fe.ShellfishChip,{rid:jt,by:Ht,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Pt?null:(0,qe.jsx)(Fe.SundayRoastChip,{rid:jt,by:Ht,app:"display",size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),(0,qe.jsx)(V.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Ts(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,qe.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.muted,children:"?"})}),'simulated'===St?(0,qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,e?null:(0,qe.jsx)(j.ExitButton,{}),ee,Ue?null:(0,qe.jsx)(N.VoiceSlot,{size:44})]})]}),Ve,I.IS_CAR||!Pt||bi?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Pt||bi?null:(0,qe.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,qe.jsxs)(K.default,{style:et,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(K.default,{style:tt,children:(0,qe.jsx)(ot,{splitOnly:!0,split:Wl,items:[]})})]})}),gt?Oi:(Ni=(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:gi(!1)}),ui]}),(0,qe.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:Ht}),Pt?(0,qe.jsx)(A.DayView,{rid:jt,day:Pt,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:[Li,(0,qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[di,ai?ni:oi,ri,Hi]})]})}),vi,Pt?null:(0,qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(P.CoversToday,{rid:jt,day:nl,sound:(0,E.flapSoundOn)(),onPress:Ei})}),Pt?null:(0,qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:yi+Le.DAY_GRAPH_CHROME},children:Mi})]}),(0,qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Ni})),Di]}),(0,qe.jsx)($.SoldOutStrip,{rid:jt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:Ls,onClose:()=>Hs(!1),rid:jt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:jt}),At.elements,os?(0,qe.jsx)(y.EditBookingPicker,{rid:jt,today:Mt,who:Ht,onClose:()=>ns(!1)}):null,as?(0,qe.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:Ht,onClose:()=>rs(null)}):null,Jt?(0,qe.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Js,plan:_t,todays:Vs,now:Ct,privacy:Ot,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Fs}):null,kl?(()=>{const e=wl[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Rl(null),Il(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${dl?rl:(0,ze.dayLong)(nl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${dl?rl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${dl?rl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):st(e.name);return(0,qe.jsx)(Q.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,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Il(null),ps(e.id)},style:{minHeight:56}},e.id)}),nl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===nl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(kl)).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)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Tl?(0,qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Tl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,qe.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Tl.ask}),(0,qe.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!hi.ok,accessibilityHint:hi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Tl.id);if(Rl(null),!e)return;const s=st(e.name);Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As)}}),(0,qe.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Rl(null)})]})]}):null,Tl?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,qe.jsx)(Q.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:!hi.ok,accessibilityHint:hi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(As,{b:e,tables:[kl]}))return;const l=(0,De.overCapacityAsk)([kl],t,e.partySize);l?Rl({id:e.id,ask:l}):(Il(null),await(0,Ie.saveTablesReported)(jt,e,[kl],s,t,As))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Rl(null),Il(null)},style:{minHeight:56}})]})})():null,ys?(()=>{const e=It.find(e=>e.id===ys);return e?(0,qe.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):st(e.name),view:Js,now:Ct,otherDay:e.date!==Mt,turnBase:wt.settings.turnMins,onClose:()=>ps(null),onDetails:Fs,onDone:As,onEdit:e=>{ps(null),rs(e.id)},onPickOnPlan:(e,t)=>{hs(!1),Ut('plan'),Qt('all'),fs({id:e.id,tables:t})}}):null})():null,ts?(0,qe.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,Ai,ds?(0,qe.jsx)(Se.ServiceSummary,{r:wt,todays:Vs,orders:kt,waitlistAll:vs,walkInCount:Ss,onClose:()=>cs(!1)}):null,Cs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ts(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Q.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ts(!1)})]}):null,Bs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ws(!1),$s(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,Rs?(0,qe.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,qe.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,ls?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,qe.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(at,{list:Ks,me:Ht,bookings:It})]}):null,Es?(0,qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,qe.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Ns.current=Date.now(),null!==_s&&Gs(null)},notice:null!==_s?`Locking again in ${_s} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),Os(null),As('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),As('Live seating plan updated on every screen.')},onCancel:()=>{Os(null),As('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(pe.Screensaver,{rid:jt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:Nt}),e?null:(0,qe.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,qe.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:jt}),e?null:(0,qe.jsx)(Re.TakeawayTakeover,{rid:jt,me:Ht})]});var Ni}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1069,797,5,6,1341,829,854,1108,861,1155,1342,1343,1344,1105,1135,1345,1346,1351,1352,1215,1353,873,1358,1359,1360,1128,1127,977,1361,1167,950,1118,1362,35,1088,1189,1027,1101,1151,1363,396,381,403,296,103,427,37,795,1238,1242,874,862,859,875,822,1104,892,1112,1073,1007,1092,1123,1364,1122,1365,1372,1374,1377,1382,1376,1383,1385,1386,1130,1109,1110,879,1391,1227,1392,1237,1229,1004,1397,1402,1403,1070,1068,1132,1405,1406,1407,1087,1182,1408,1181,1174,870,1354,1409,26]); __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},1342,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1343,[1005,1073]); @@ -1482,7 +1482,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";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}:{}}))}},1399,[]); __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)}},1400,[879,859,878]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1401,[5,1007,904,958]); -__d(function(g,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,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:w,blocks:M=[],height:v=150,forecastNote:k,emptyText:$,past:D,closed:A,compact:I=!1,dense:C=!1,bare:L=!1,fill:_=!1,fit:z=!1,tight:H=!1,live:O=!1}){const[S,F]=(0,t.useState)(0),[P,R]=(0,t.useState)(0),N=j.getTime()-18e5,B=T.getTime()+36e5,E=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(N),new Date(B),w),[e,N,B,w]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(M,W,X),[M,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=z&&P?Math.max(24,Math.floor(P)):Math.max(48,v-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=C?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:O,past:D,closed:A}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},he=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),de=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&de.push(t.getTime())}const ue=O?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),xe=A?null:O?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,ge=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:de,busiest:xe}):{hours:[],busiest:null},me=he(E),pe=le?he(ae.before):me,fe=le?he(ae.after):'',ye=_&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,we=ge.busiest?.text??(A?'':O?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),Me=U.map(e=>e.spoken).join('. '),ve=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${we?` ${we}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${ve} percent of the way through the day.`:''}${Me?` ${Me}.`:''}`,$e=(0,u.hm)(b),De=Math.max(44,12*$e.length*.7+16),Ae=Math.max(q+2,Math.min(Math.max(0,S-J-De),se(re)-De/2)),Ie=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,z?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:L?4:C?2:10,paddingBottom:L?2:6,backgroundColor:c.colours.bg}],children:[L?null:I?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),L||H?null:A?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ke,onLayout:e=>{F(e.nativeEvent.layout.width),z&&R(e.nativeEvent.layout.height)},style:z?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,v-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,A?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,ge.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:ge.busiest.x+ge.busiest.w/2,y:ge.busiest.y+ge.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:ge.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Ae,top:Ie,minWidth:De,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),ge.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':i(0,f.coverCurve)(e,new Date(N),new Date(B),v),[e,N,B,v]),W=60*j.getHours()+j.getMinutes(),X=60*T.getHours()+T.getMinutes(),U=(0,t.useMemo)(()=>(0,p.chartBands)(w,W,X),[w,W,X]),G=new Date(j);G.setHours(0,0,0,0);const Y=e=>G.getTime()+6e4*e,V=Math.max(8,...E.map(e=>e.covers)),K=E.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),U)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),Z=O&&P?Math.max(24,Math.floor(P)):Math.max(48,M-m.AXIS_BAND),q=m.CHART_PAD_L,J=m.CHART_PAD_R,Q=A?18:22,ee=Math.max(10,S-q-J),te=Math.max(10,Z-Q-14),se=e=>q+(e-N)/(B-N)*ee,ie=e=>Q+te-e/(1.15*V)*te,oe=(0,m.yTicks)(V),ne=(0,m.fitYTicks)(oe,ie,Z,13),le=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:$,closed:I}),re=b.getTime(),ae=le&&E.length?(0,m.splitCurve)(E,re):{before:E,after:[]},de=e=>e.map((e,t)=>`${t?'L':'M'}${se(e.t).toFixed(1)},${ie(e.covers).toFixed(1)}`).join(' '),he=[];for(let e=new Date(N);e.getTime()<=B;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=N&&t.getTime()<=B&&he.push(t.getTime())}const ue=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ce=Math.min(B,Math.max(N,b.getTime())),ge=I?null:H?{t:ce,covers:ue,text:(0,m.seatedNowText)(ue)}:K,xe=S?(0,m.layoutChart)({width:S,height:Z,t0:N,t1:B,hours:he,busiest:ge}):{hours:[],busiest:null},me=de(E),pe=le?de(ae.before):me,fe=le?de(ae.after):'',ye=z&&me&&E.length>1?`${me} L${se(E[E.length-1].t).toFixed(1)},${ie(0).toFixed(1)} L${se(E[0].t).toFixed(1)},${ie(0).toFixed(1)} Z`:'',je=(0,i.coversFour)(e,e[0]?.date??''),Te=`Total ${je.total} ${1===je.total?'Cover':'Covers'}`,be=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ve=xe.busiest?.text??(I?'':H?(0,m.seatedNowText)(ue):K?(0,m.busiestText)(K.t,K.covers):''),we=U.map(e=>e.spoken).join('. '),Me=le&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((re-j.getTime())/(T.getTime()-j.getTime())*100))):null,ke=!I&&K&&K.covers?(0,m.peakOccupancyText)(K.t,K.covers):'',De=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${ke?` ${ke}.`:''}${ve?` ${ve}.`:''}${le?` It is ${(0,u.hm)(b)}. About ${Me} percent of the way through the day.`:''}${we?` ${we}.`:''}`,$e=(0,u.hm)(b),Ie=Math.max(44,12*$e.length*.7+16),Le=Math.max(q+2,Math.min(Math.max(0,S-J-Ie),se(re)-Ie/2)),Ae=Math.max(2,Math.min(Z-22,Q+te-22)),Ce=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[h.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:C?4:A?2:10,paddingBottom:C?2:6,backgroundColor:c.colours.bg}],children:[C?null:L?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:Te}),ke?(0,y.jsx)(d.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:ke}):null]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:A?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:Te})]}),C||_?null:I?k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),ke&&!L?(0,y.jsx)(d.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:ke}):k?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),C||_||L||!k||!ke?null:(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),C||!_||!ke||L?null:(0,y.jsx)(d.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:ke}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:De,onLayout:e=>{F(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:Z,minHeight:Z,position:'relative',overflow:'hidden'},children:[S?(0,y.jsxs)(l.default,{width:S,height:Z,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Ce}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Ce}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),U.map((e,t)=>(0,y.jsx)(n.Rect,{x:se(Y(e.fromMin)),y:Q,width:Math.max(3,se(Y(e.toMin))-se(Y(e.fromMin))),height:te,fill:`url(#${Ce}-${e.strength})`},`${e.fromMin}-${t}`)),oe.map(e=>(0,y.jsx)(n.Line,{x1:q,x2:q+ee,y1:ie(e),y2:ie(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),le?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:se(j.getTime()),y:Q,width:Math.max(0,se(re)-se(j.getTime())),height:te,fill:c.colours.gold,opacity:.12}):null,ye?(0,y.jsx)(n.Path,{d:ye,fill:"#3A2F1E",stroke:"none"}):null,pe?(0,y.jsx)(n.Path,{d:pe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,fe?(0,y.jsx)(n.Path,{d:fe,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:se(e.getTime()),x2:se(e.getTime()),y1:Q,y2:Q+te,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:se(re),x2:se(re),y1:Q,y2:Q+te,stroke:c.colours.gold,strokeWidth:2}):null,xe.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:xe.busiest.x+xe.busiest.w/2,y:xe.busiest.y+xe.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:xe.busiest.text}):null,be?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:q+ee/2,y:Q+te/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,S?ne.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:q-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(d.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,S&&le&&Z>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:Le,top:Ae,minWidth:Ie,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(d.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:$e})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),xe.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,S)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,S-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1403,[]); __d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1404,[1092]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1405,[861,1384]); diff --git a/staff-app/admin.html b/staff-app/admin.html index 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 5df829b410316b7a9151ff180054bcebb959f3ba..3b57bbb175d508bc55dbb39af124afc4cd5bb2cb 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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 05dd5595fe1b89c1c801f9bf96265a41453734fe..0b49b12ea16c1bb85063443bc0961c7ad8365c4a 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-8fab057e5d"; +const V = "cc-staff-605775f7dc"; 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=8fab057e5d31c89931ebaf810930a4b07390ebfd37394827f4ba2b932a45cd91"]; +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=605775f7dcccaccf1ea65dcbf9e4bc2a72b96773e994c756030a9fd43d1e95f0"]; // 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 7b8d1a2b512965bb323e9f31a4f52883fca8ba8c..7f18277cda0ac1c6ba5d1779914408c149881acc 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); })(); - +