+
+
+
diff --git a/smoking-goat-ayr/owner-app/sw.js b/smoking-goat-ayr/owner-app/sw.js
new file mode 100644
index 0000000000000000000000000000000000000000..7fc68864317e30731995b84f0b10f322eb68b5b5
--- /dev/null
+++ b/smoking-goat-ayr/owner-app/sw.js
@@ -0,0 +1,4 @@
+const V="cc-smokinggoat-owner-36165a28d4da973d",B="/smoking-goat-ayr/owner-app/",P=["/smoking-goat-ayr/owner-app/apple-touch-icon.png", "/smoking-goat-ayr/owner-app/favicon.ico", "/smoking-goat-ayr/owner-app/icon-192.png", "/smoking-goat-ayr/owner-app/icon-512.png", "/smoking-goat-ayr/owner-app/brand-logo.png", "/smoking-goat-ayr/owner-app/index.html", "/smoking-goat-ayr/owner-app/manifest.webmanifest", "/smoking-goat-ayr/owner-app/brand-hero.png", "/smoking-goat-ayr/owner-app/owner.html", "/smoking-goat-ayr/owner-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-e196fd8b19ecc6189ee08bcd5ff2f404.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-c7e2d26b899345aed640aa075a97d318.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/[token]-3c722cbf6e54dbbeb30a3a3ee3ece670.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/__common-8f1e648e28b952b55109db85160e20d8.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-0b428a479ff6b089927064a714ba6dc8.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-a2bc975e05bacde878be5f119b842ed4.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/_layout-921961b8f95ff3b160946e11aff1f142.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-10b44538fce9f65ce117321a623552df.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/basket-4d740db9aeba1d77232a0091a5892917.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/smoking-goat-ayr/owner-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/smoking-goat-ayr/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/smoking-goat-ayr/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/smoking-goat-ayr/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/smoking-goat-ayr/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/smoking-goat-ayr/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/smoking-goat-ayr/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/smoking-goat-ayr/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/smoking-goat-ayr/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/smoking-goat-ayr/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/smoking-goat-ayr/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/smoking-goat-ayr/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/smoking-goat-ayr/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/smoking-goat-ayr/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"];
+self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting())));
+self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-smokinggoat-owner-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim())));
+self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request)));});
\ No newline at end of file
diff --git a/smoking-goat-ayr/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js b/smoking-goat-ayr/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js
new file mode 100644
index 0000000000000000000000000000000000000000..cf2e6d94e8ca98606e0f8533c347ea51139bfdb7
--- /dev/null
+++ b/smoking-goat-ayr/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js
@@ -0,0 +1 @@
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},801,[804,30,806,24]);
\ No newline at end of file
diff --git a/smoking-goat-ayr/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js b/smoking-goat-ayr/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js
new file mode 100644
index 0000000000000000000000000000000000000000..1f0ffb8d5093d5a183dc2a9c0fb7062951faa5c1
--- /dev/null
+++ b/smoking-goat-ayr/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js
@@ -0,0 +1 @@
+__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=_r(_d[0]),n=_r(_d[1]),l=e(_r(_d[2])),s=e(_r(_d[3])),r=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]);function f(){const{rid:e,did:f}=(0,t.useLocalSearchParams)(),b=(0,u.useRestaurant)(e),j=(0,u.useMenu)(e).find(e=>e.id===f),x=(0,u.useCustomer)(),m=(0,u.useRecipeCards)(e).find(e=>e.id===j?.recipeCardId),y=m?.signOff&&m.photo?(0,h.recipeCards)().photoSource(m.photo):null,k=(0,u.useStore)(e=>e.addLine),[v,w]=(0,n.useState)(()=>(j?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[S,C]=(0,n.useState)(1),[B,$]=(0,n.useState)(''),[I,P]=(0,n.useState)(!1),[L,T]=(0,n.useState)(!1),[D,O]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),R=(0,n.useMemo)(()=>j?(0,d.effectiveAllergens)(j,v):{},[j,v]);if(!b||!j)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Dish not found."})});const q=(0,d.conflictsFor)(R,x.allergies),_=(j.price??0)+(j.optionGroups??[]).flatMap(e=>e.choices).filter(e=>v.includes(e.id)).reduce((e,t)=>e+t.priceDelta,0),N=j.soldOut||!j.signOff||null===j.price,G=(e,t)=>{const n=j.optionGroups.find(t=>t.id===e);w(e=>{const l=n.choices.map(e=>e.id);return n.multi?e.includes(t)?e.filter(e=>e!==t):[...e,t]:e.includes(t)&&!n.required?e.filter(e=>e!==t):[...e.filter(e=>!l.includes(e)),t]})},z=e=>{u.useStore.getState().basket.restaurantId!==b.id&&u.useStore.getState().startBasket(b.id,'takeaway'),k({itemId:j.id,qty:S,choiceIds:v,notes:B,override:e?{allergens:q.contains,at:(new Date).toISOString()}:void 0}),P(!1),M(!0)};return(0,p.jsxs)(o.Screen,{title:j.name,subtitle:b.name,right:(0,p.jsx)(a.BasketButton,{}),children:[y?(0,p.jsx)(l.default,{testID:"dish-photo",source:y,accessibilityLabel:`${j.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,p.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(o.T,{weight:"bold",size:20,colour:g.colours.gold,children:null===j.price?j.priceNote:(0,c.gbp)(_)}),j.dietary.map(e=>(0,p.jsx)(o.Badge,{kind:"ok",label:e},e))]}),(0,p.jsx)(o.T,{children:j.description}),q.contains.length?(0,p.jsx)(o.Banner,{kind:"danger",title:`Blocked: contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,q.may.length?(0,p.jsx)(o.Banner,{kind:"warn",title:`Warning: may contain ${q.may.map(d.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(j.optionGroups??[]).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:e.choices.map(t=>(0,p.jsx)(o.Chip,{label:t.label,sub:t.priceDelta?`+${(0,c.gbp)(t.priceDelta)}`:void 0,selected:v.includes(t.id),onPress:()=>G(e.id,t.id)},t.id))})]},e.id)),(0,p.jsx)(o.Card,{children:(0,p.jsx)(r.AllergenPanel,{item:j,map:R,declared:x.allergies})}),b.fictional?null:(0,p.jsx)(o.ExampleAllergenNotice,{}),(0,p.jsx)(o.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:B,onChangeText:$}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Quantity"}),(0,p.jsx)(o.Stepper,{value:S,onChange:C,label:"quantity"})]}),A?(0,p.jsx)(o.Banner,{kind:"success",title:"Added to basket",children:q.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,N?(0,p.jsx)(o.Banner,{kind:"warn",children:j.soldOut?'Sold out today.':j.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):q.contains.length?(0,p.jsxs)(s.default,{style:{gap:8},children:[(0,p.jsx)(o.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,p.jsx)(o.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{T(!1),O(!1),P(!0)},testID:"override-open"})]}):(0,p.jsxs)(o.Row,{gap:8,children:[(0,p.jsx)(o.Button,{style:{flex:1},label:`Add ${S} to basket \xb7 ${(0,c.gbp)(_*S)}`,onPress:()=>z(!1),testID:"add-to-basket"}),A?(0,p.jsx)(o.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,p.jsxs)(o.Sheet,{visible:I,onClose:()=>P(!1),title:"Allergy override",children:[(0,p.jsx)(o.Banner,{kind:"danger",title:`${j.name} contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`Your profile says: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}.`}),(0,p.jsx)(o.Toggle,{label:"I understand this dish contains an allergen I have declared",value:L,onChange:T}),(0,p.jsx)(o.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:D,onChange:O}),(0,p.jsx)(o.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,p.jsx)(o.Button,{kind:"danger",disabled:!L||!D,label:"Confirm override and add",onPress:()=>z(!0),testID:"override-confirm"})]})]})}},778,[804,30,196,127,829,830,813,814,816,819,831,821,24]);
\ No newline at end of file
diff --git a/smoking-goat-ayr/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js b/smoking-goat-ayr/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1ced89e3ab9de89839af726f375c95f9fe94a33
--- /dev/null
+++ b/smoking-goat-ayr/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js
@@ -0,0 +1 @@
+__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},794,[833,804,30,813,819,5,836,24]);
\ No newline at end of file
diff --git a/smoking-goat-ayr/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js b/smoking-goat-ayr/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js
new file mode 100644
index 0000000000000000000000000000000000000000..f0fcaabb7a82273cae61ec240fcab227e980b17e
--- /dev/null
+++ b/smoking-goat-ayr/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js
@@ -0,0 +1 @@
+__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]),y=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,s.useLocalSearchParams)(),r=(0,b.useOrder)(e),f=(0,b.useRestaurant)(r?.restaurantId),[C,S]=(0,l.useState)(0),[k,T]=(0,l.useState)(''),[v,P]=(0,l.useState)(!1),[M,$]=(0,l.useState)(!1),[R,A]=(0,l.useState)(1),[I,N]=(0,l.useState)(0),[O,B]=(0,l.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(c.Screen,{title:"Order",children:(0,j.jsx)(c.T,{children:"Order not found."})});const H='takeaway'===r.type?x:w,_=Math.max(0,H.findIndex(([e])=>e===r.status)),D=Math.round(r.subtotal*I/100),F='table'===r.type?r.subtotal+(r.split?r.tip:D):r.total,q=F-r.paid,L=r.split?.ways??O,W=r.split?.paidShares??0,Y=Math.ceil(F/L),E='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(c.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,p.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(c.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Status"}),H.map(([e,t],s)=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:s<=_?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(c.T,{weight:s===_?'semibold':'regular',colour:s<=_?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(c.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,p.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(c.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||E?null:(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>b.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(c.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>b.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(c.T,{children:(0,h.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(c.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(c.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(u.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Subtotal"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Of which gift card"}),(0,j.jsxs)(c.T,{colour:y.colours.ok,children:["\u2212",(0,h.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Tip"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.tip)})]}):null,(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.gold,children:(0,h.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(c.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(F)," \xb7 split ",L," way",L>1?'s':''," \xb7 ",(0,h.gbp)(Y)," each"]}),(0,j.jsxs)(c.T,{children:["Shares paid: ",W," of ",L," \xb7 remaining ",(0,h.gbp)(q)]}),L>1?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{children:"Shares to pay now"}),(0,j.jsx)(c.Stepper,{value:R,onChange:A,min:1,max:L-W,label:"shares"})]}):null,(0,j.jsx)(c.Button,{label:`Pay ${L>1?`${R} share${R>1?'s':''}`:'bill'} \xb7 ${(0,h.gbp)(Math.min(q,Y*R))}`,onPress:()=>$(!0),testID:"pay-bill"})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(c.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(c.Chip,{label:e?`${e}%`:'No tip',selected:I===e,onPress:()=>N(e)},e))}),(0,j.jsx)(c.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(c.Stepper,{value:O,onChange:B,min:1,max:8,label:"people"})]}),(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(r.subtotal+D),O>1?` \xb7 ${(0,h.gbp)(Math.ceil((r.subtotal+D)/O))} each`:'']}),(0,j.jsx)(c.Button,{label:"Get the bill",onPress:()=>b.repo.orders.setSplit(r.id,O,D),testID:"get-bill"})]})]}):null,!E||r.rated||v?null:(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(c.H2,{children:"How was everything?"}),(0,j.jsxs)(c.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(i.Stars,{value:C,onChange:S}),C?(0,j.jsx)(c.Field,{label:"Anything to add? (optional)",value:k,onChangeText:T}):null,(0,j.jsx)(c.Button,{label:"Send feedback",disabled:!C,onPress:()=>{b.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:C,comment:k,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),P(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(c.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,E?(0,j.jsx)(c.Button,{kind:"secondary",label:"View stamp card",onPress:()=>s.router.push(`/customer/${f.id}/loyalty`)}):null,(0,j.jsx)(o.MockPay,{visible:M,onClose:()=>$(!1),amount:Math.min(q,Y*R),restaurantId:f.id,title:`Pay \u2014 ${(0,t.tableNumbers)(r.tableNo)}`,onPaid:e=>{b.repo.orders.payTable(r.id,{shares:R,giftCardCode:e.giftCardCode}),$(!1),A(1)}})]})}},791,[808,804,30,127,834,832,813,814,816,818,819,821,24]);
\ No newline at end of file
diff --git a/smoking-goat-ayr/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js b/smoking-goat-ayr/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js
new file mode 100644
index 0000000000000000000000000000000000000000..11f3bab84de38d8d8874b5ec2723dd3ea24b04a1
--- /dev/null
+++ b/smoking-goat-ayr/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js
@@ -0,0 +1 @@
+__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 s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},775,[804,30,805,806,807,24]);
\ No newline at end of file
diff --git a/smoking-goat-ayr/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js b/smoking-goat-ayr/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js
new file mode 100644
index 0000000000000000000000000000000000000000..bbb9c120ac56fbfa8ba9e0a1c2e306f6558c994f
--- /dev/null
+++ b/smoking-goat-ayr/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js
@@ -0,0 +1,3 @@
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},795,[804,30,813,874,876,836,24]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,b]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[j,y]=(0,n.useState)([]),[k,w]=(0,n.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,n.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,P]=(0,n.useState)(''),[O,N]=(0,n.useState)(''),[B,I]=(0,n.useState)(!1),[L,M]=(0,n.useState)(null),[R,$]=(0,n.useState)([]),A=(0,n.useCallback)(async()=>{try{b(await(0,c.tablePublic)(e)),f(null)}catch(e){f(e?.message??'Could not load the menu.')}},[e]),D=(0,n.useCallback)(async()=>{try{$(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,n.useEffect)(()=>{A(),D();const e=setInterval(()=>{D(),A()},8e3);return()=>clearInterval(e)},[A,D]);const _=s?.menu??[];(0,n.useEffect)(()=>{y(e=>e.filter(e=>_.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const q=(0,n.useMemo)(()=>{const e=new Map;for(const t of _)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,_),W='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],E=(0,d.allergyClashes)(j,_,W.map(e=>e.allergen)),z=e=>j.find(t=>t.id===e)?.qty??0,G=(e,t)=>y(l=>t<=0?l.filter(t=>t.id!==e):l.some(t=>t.id===e)?l.map(l=>l.id===e?{...l,qty:t}:l):[...l,{id:e,qty:t,note:''}]),H=(e,t)=>y(l=>l.map(l=>l.id===e?{...l,note:t}:l)),V=async()=>{I(!0),M(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:O,name:v,allergies:W});y([]),N(''),M({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.`}),D()}catch(e){M({kind:'warn',text:e?.message??'The order was not sent. Please try again or ask a member of staff.'}),A()}finally{I(!1)}};if(m)return(0,x.jsxs)(r.Screen,{title:"Order at the table",children:[(0,x.jsx)(r.Banner,{kind:"warn",title:"Couldn't open the menu",children:m}),(0,x.jsx)(r.Button,{label:"Try again",onPress:()=>{A()}})]});if(!s)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const F=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&!B;return(0,x.jsxs)(r.Screen,{title:`${(0,l.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,x.jsx)(r.Button,{label:B?'Sending\u2026':j.length?`Send order to the kitchen (${(0,o.gbp)(Y)})`:'Add a dish to order',disabled:!F,onPress:()=>{V()},testID:"send-table-order-live"}):void 0,children:[(0,x.jsxs)(r.Muted,{children:["Tip: add dishes, answer the allergy question, then send. Staff bring it to ",(0,l.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,x.jsx)(r.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,x.jsx)(r.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!R.some(e=>e.accepted)?(0,x.jsx)(r.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,L?(0,x.jsx)(r.Banner,{kind:L.kind,children:L.text}):null,R.length?(0,x.jsx)(a.default,{testID:"my-table-orders",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your orders at this table"}),R.map(e=>(0,x.jsxs)(a.default,{style:{gap:2,paddingVertical:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{children:e.ref}),(0,x.jsx)(r.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,x.jsxs)(r.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,o.gbp)(e.totalPence)," to pay at the bar or till"]})]},e.id))]})}):null,s.open?q.map(([e,t])=>(0,x.jsxs)(a.default,{style:{gap:8},children:[(0,x.jsx)(r.H2,{children:e}),t.map(e=>(0,x.jsxs)(r.Card,{children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,x.jsxs)(a.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(r.T,{weight:"semibold",children:e.name}),e.description?(0,x.jsx)(r.Muted,{children:e.description}):null,(0,x.jsxs)(r.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(i.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(i.allergenLabel).join(', ')}`:'']})]}),(0,x.jsx)(r.T,{weight:"semibold",colour:u.colours.gold,children:(0,o.gbp)(e.pricePence)})]}),e.soldOut?(0,x.jsx)(r.Badge,{kind:"amber",label:"Sold out today"}):z(e.id)?(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.Stepper,{value:z(e.id),min:0,max:20,onChange:t=>G(e.id,t),label:e.name}),(0,x.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>G(e.id,0)})]}):(0,x.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>G(e.id,1)})]},e.id))]},e)):null,s.open&&!_.length?(0,x.jsx)(r.Banner,{kind:"demo",title:"No dishes to order yet",children:"The venue hasn't put any priced dishes on the table menu yet. Please order at the bar."}):null,s.open&&j.length?(0,x.jsx)(a.default,{testID:"table-cart",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your order"}),j.map(e=>{const l=_.find(t=>t.id===e.id);return(0,x.jsxs)(a.default,{style:{gap:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.T,{children:[e.qty,"\xd7 ",l?.name]}),(0,x.jsx)(r.T,{children:(0,o.gbp)(e.qty*(l?.pricePence??0))})]}),(0,x.jsx)(t.TextInput,{style:p,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 ${l?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Total"}),(0,x.jsx)(r.T,{weight:"semibold",children:(0,o.gbp)(Y)})]})]})}):null,s.open?(0,x.jsx)(a.default,{testID:"table-allergy",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,x.jsx)(r.Muted,{children:"We ask everyone, so the kitchen can keep you safe."}),(0,x.jsxs)(r.Row,{gap:8,children:[(0,x.jsx)(r.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,x.jsx)(r.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,x.jsx)(r.Row,{wrap:!0,gap:6,children:i.ALLERGENS.map(e=>(0,x.jsx)(r.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,E.length?(0,x.jsxs)(r.Banner,{kind:"warn",title:"Check with staff",children:[E.map(e=>e.name).join(', ')," ",E.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,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Anything else?"}),(0,x.jsx)(t.TextInput,{style:p,value:v,onChangeText:P,placeholder:"Your first name (optional)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your first name (optional)"}),(0,x.jsx)(t.TextInput,{style:p,value:O,onChangeText:N,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,x.jsx)(a.default,{testID:"pay-placeholder",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Paying"}),(0,x.jsx)(r.T,{children:d.PAY_WORDS}),(0,x.jsx)(r.Muted,{children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),x=_r(_d[11]);const p={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},874,[877,808,30,127,813,814,816,876,875,819,821,24]);
+__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.');return(0,n.rpc)('guest_table_order',{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})},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,"makeTableCodes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return c}}),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=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),c=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},875,[863,820,876]);
\ No newline at end of file
diff --git a/smoking-goat-ayr/staff-app/_expo/static/js/web/__common-f699c3af80c74a1d300d85ad5286f8b0.js b/smoking-goat-ayr/staff-app/_expo/static/js/web/__common-f699c3af80c74a1d300d85ad5286f8b0.js
new file mode 100644
index 0000000000000000000000000000000000000000..e95a4aa298784d0e19ba4d7c976394fc03e56327
--- /dev/null
+++ b/smoking-goat-ayr/staff-app/_expo/static/js/web/__common-f699c3af80c74a1d300d85ad5286f8b0.js
@@ -0,0 +1,462 @@
+__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},804,[1210,1211,1221,1222,1224]);
+__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:t,me:i,now:$}=(0,G.useChef)(3e4),_=(0,W.useSignedIn)(),K=_?.id??G.CHEF_ID;(0,o.useSoldOutLink)(!0,(_?.name??i).replace(' (example)',''));const V=e?me[e]:void 0,[ue,je]=(0,P.useState)(V?.tab??'home'),[we,Ce]=(0,P.useState)(V?.k??null),[Te,ve]=(0,P.useState)(V?.stock??'levels'),[Se,Pe]=(0,P.useState)(void 0),[Ie,Re]=(0,P.useState)(V?.gp??'dishes'),Be=(0,P.useRef)(null),He=(0,f.ymd)($),Ae=(0,f.ymd)(new Date($.getTime()+864e5));(0,u.useTipsPosted)(t,He);const Oe=(0,Q.useTravelDay)('chef',He),De='home'===ue&&!Oe;(0,v.useKitchenTodoChime)(t,He,()=>Fe('kitchen','bookings')),(0,de.useAlertWatcher)(t,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,W.ensureAttendance)((new Date).toISOString().slice(0,10),$)},[]);const Le=(0,P.useRef)({t:'home',k:null});Le.current={t:ue,k:we};const Ee=(0,P.useRef)([]),$e=(0,n.useScrollMemory)(Be),Fe=(0,P.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.k===s||(Ee.current=[...Ee.current,{...t,y:$e.leave()}].slice(-30),$e.restore(0)),je(e),Ce(s)},[]),We=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.k===e.k;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.k)return!1;const t=s??{t:'home',k:null};return $e.leave(),je(t.t),Ce(t.k),$e.restore(t.y??0),!0},[]);(0,l.useWebBack)(We);const Ge=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{d.PITCH&&(globalThis.__pitchGo=(e,s=null,t)=>{'stock'===e&&t&&ve(t),'gp'===e&&t&&Re(t),Fe(e,s)})},[Fe]),(0,p.useShiftReminders)({rid:t,staffId:K,name:i,kitchen:!0}),(0,C.useScheduledNotices)({rid:t,staffId:_?.id??'',name:i,onOpen:()=>Fe('kitchen','orderlists')}),(0,T.useOffRotaPrompt)({rid:t,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',We);return()=>e.remove()},[We]);const Me=we?ye.find(e=>e.id===we):null,Ne=(0,H.default)().width<430,ze=Me?Me.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:ie.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[ue];return(0,be.jsxs)(O.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,be.jsxs)(A.default,{style:{paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,be.jsx)(A.default,{style:{alignItems:'center'},children:(0,be.jsx)(A.default,{testID:"header-me",accessibilityLabel:`Signed in as ${i.replace(' (example)','')}, Head Chef`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'86%'},children:(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(se.StaffAvatar,{id:G.CHEF_ID,size:24,ring:!1}),(0,be.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[i.replace(' (example)','')," \xb7 Head Chef"]})]})})}),(0,be.jsxs)(E.Row,{gap:10,children:[(0,be.jsx)(D.RestaurantLogo,{rid:t,size:Ne?36:44}),(0,be.jsxs)(A.default,{style:{flex:1,minWidth:0},children:[(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(E.T,{weight:"semibold",size:Ne?15:17,numberOfLines:1,style:{flexShrink:1},children:s.name}),(0,be.jsx)(w.AppBadge,{label:"CHEF"})]}),(0,be.jsx)(E.T,{size:12,colour:F.colours.muted,numberOfLines:1,children:"Head Chef app"}),(0,be.jsx)(D.PoweredBy,{})]}),(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,te.appUrl)('staff');e&&window.location.assign(e)},style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,be.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})}),(0,be.jsx)(L.VoiceSlot,{})]})]}),(0,be.jsxs)(B.default,{ref:Be,...$e.props,contentContainerStyle:{padding:14,paddingBottom:60,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:['home'===ue&&!we||Ge?null:(0,be.jsx)(l.BackButton,{onPress:We}),(0,be.jsx)(E.T,{size:22,weight:"bold",style:{flex:1,textAlign:'home'===ue&&!we||Ge?'left':'right'},children:ze})]}),'home'===ue?(0,be.jsx)(Q.DayBar,{app:"chef",today:He}):null,'home'===ue&&Oe?(0,be.jsx)(Q.DayView,{rid:t,day:Oe,today:He,app:"chef"}):null,'home'===ue?(0,be.jsx)(ee.WhoBar,{}):null,De&&_?(0,be.jsx)(h.MyTasksToday,{rid:t,staffId:_.id,name:_.name,onShift:(0,p.shiftNow)(_.id,$.getTime()).on}):null,De?(0,be.jsx)(u.TodaysTipsCard,{rid:t,today:He}):null,De?(0,be.jsx)(u.TipsPotCard,{rid:t,today:He}):null,De?(0,be.jsx)(b.CoversToday,{rid:t,onPress:()=>Fe('kitchen','bookings')}):null,De?(0,be.jsx)(k.LastFoodBanner,{rid:t,now:$}):null,De?(0,be.jsx)(y.NextTableFreeCard,{rid:t,now:$}):null,De?(0,be.jsx)(x.KitchenSignoffs,{rid:t,today:He,by:i,app:"chef"}):null,De?(0,be.jsxs)(A.default,{style:{gap:4},children:[(0,be.jsx)(x.PlattersBooked,{rid:t,date:He,label:"Platters booked today"}),(0,be.jsx)(x.PlattersBooked,{rid:t,date:Ae,label:"Platters booked tomorrow"})]}):null,De?(0,be.jsx)(pe.ChefAssistantButton,{}):null,De?(0,be.jsx)(xe,{go:(e,s)=>{'stock'===e&&s&&ve(s),'gp'===e&&s&&Re(s),'orders'===e&&Pe(s),Fe(e,'kitchen'===e?s??null:null)}}):null,'stock'===ue?(0,be.jsx)(U.StockScreen,{initial:Te},Te):null,'gp'===ue?(0,be.jsx)(M.GpScreen,{initial:Ie},Ie):null,'creator'===ue?(0,be.jsx)(ie.DishCreator,{rid:t,canPublish:!1}):null,'orders'===ue?(0,be.jsx)(z.OrdersScreen,{focus:Se},Se??'all'):null,'kitchen'!==ue||Me?null:(0,be.jsxs)(A.default,{style:{gap:10},children:[(0,be.jsx)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:ye.map((e,s)=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Fe(ue,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,be.jsxs)(A.default,{style:{flex:1},children:[(0,be.jsx)(E.T,{weight:"medium",children:e.title}),(0,be.jsx)(E.Muted,{children:e.sub})]}),(0,be.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,be.jsx)(E.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,be.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",r.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===we&&K?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-myshift",children:[(0,be.jsx)(X.ClockInOut,{}),(0,be.jsx)(Z.MyUpcomingShifts,{staffId:K})]}):null,'mypay'===we?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-mypay",children:[(0,be.jsx)(Y.MyPeriods,{staffId:K}),(0,be.jsx)(q.MyHoursPay,{staffId:K}),(0,be.jsx)(J.MyTips,{staffId:K}),(0,be.jsxs)(E.Card,{children:[(0,be.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,be.jsx)(E.Muted,{children:"Get reminders like \u201cMills milk order\u201d on this phone, even with the app closed (once your manager switches phone notifications on). iPhone: add the app to your Home Screen first (iOS 16.4 or later)."}),(0,be.jsx)(c.PushButton,{})]})]}):null,'bookings'===we?(0,be.jsx)(S.TodaysBookings,{rid:t,today:He,by:i,app:"chef"}):null,'specials'===we?(0,be.jsx)(le.SpecialsEditor,{rid:t,me:i,app:"chef",now:$}):null,'prep'===we?(0,be.jsx)(N.PrepScreen,{}):null,'live'===we?(0,be.jsx)(N.TeamScreen,{}):null,'waste'===we?(0,be.jsx)(N.WasteScreen,{}):null,'recipes'===we?(0,be.jsx)(ce.RecipeCards,{rid:t,actor:{name:i,role:'head-chef'},mode:"edit"}):null,'allergens'===we?(0,be.jsx)(N.AllergenScreen,{openCards:()=>Fe('kitchen','recipes')}):null,'compliance'===we?(0,be.jsx)(N.ComplianceScreen,{}):null,'takings'===we?(0,be.jsx)(u.CashUpScreen,{rid:t,today:He,canEdit:!1,chartsOnly:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'board'===we?(0,be.jsx)(he.QuestionBoard,{rid:t,today:He,manager:!1,by:""}):null,'teamtasks'===we?(0,be.jsx)(h.KitchenTeamTasks,{rid:t,actor:_}):null,'orderlists'===we?(0,be.jsx)(j.OrderListsScreen,{rid:t,today:He,editor:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'foodsafety'===we?(0,be.jsx)(c.FoodSafetyCard,{children:(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Fe('kitchen','haccp'),children:(0,be.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===we?(0,be.jsx)(ne.HaccpLog,{mode:"chef",me:i,meId:G.CHEF_ID,now:$}):null,'accidents'===we?(0,be.jsx)(oe.AccidentBook,{app:"chef",me:i,meId:G.CHEF_ID,now:$,seeAll:!1}):null]}),(0,be.jsx)(A.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderTopWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface},children:ke.map(e=>{const s=ue===e.id;return(0,be.jsxs)(R.default,{accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:e.label,onPress:()=>Fe(e.id),style:{flex:1,alignItems:'center',paddingVertical:8,paddingHorizontal:2,minHeight:52,gap:2},children:[(0,be.jsx)(fe.Icon,{name:e.icon,colour:s?F.colours.gold:F.colours.muted}),(0,be.jsx)(E.T,{size:e.label.length>10?10:11,weight:s?'semibold':'regular',colour:s?F.colours.gold:F.colours.muted,center:!0,children:e.label})]},e.id)})}),(0,be.jsx)(pe.ChefAssistantSheet,{go:(e,s)=>{'orders'===e?(Pe(s),Fe('orders')):'gp'===e?Fe('gp'):Fe('kitchen',e)}}),(0,be.jsx)(re.AlertHost,{variant:"chef",rid:t,skipTakeaway:!0}),(0,be.jsx)(ae.KitchenFlash,{rid:t,me:i})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),C=_r(_d[19]),T=_r(_d[20]),v=_r(_d[21]),S=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),B=e(_r(_d[27])),H=e(_r(_d[28])),A=e(_r(_d[29])),O=_r(_d[30]),D=_r(_d[31]),L=_r(_d[32]),E=_r(_d[33]),$=_r(_d[34]),F=_r(_d[35]),W=_r(_d[36]),_=_r(_d[37]),G=_r(_d[38]),M=_r(_d[39]),N=_r(_d[40]),z=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]),te=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),le=_r(_d[57]),re=_r(_d[58]),ae=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),he=_r(_d[62]),ue=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]);s.LIVE_HEAD_CHEF&&(0,t.requireRealData)();const ke=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ie.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],ye=[{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],me={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function xe({go:e}){const{k:s,c:t,menu:o,now:n,rid:l,me:r}=(0,G.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,G.useWeek)(),{covers:h,label:u,enough:p,booked:f}=(0,G.useForecast)(),b=(0,z.useSuggestions)(),k=s.ingredients.filter(e=>e.onHand<=0||(0,G.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(o,s.recipes,s.ingredients,s.targetGp).filter(e=>e.dropped.length),j=s.deliveries.filter(e=>'expected'===e.status),w=!s.recipes.length||!s.ingredients.length,C=w?[]:t.filter(e=>e.below),T=(0,i.useLiveState)(),v=(0,ue.useRecipeCards)(l).filter(e=>!e.signOff);return(0,be.jsxs)(A.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,be.jsx)(ne.MissedBanner,{mode:"chef",now:n,onPress:()=>e('kitchen','haccp')}),d.map(s=>(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',s.supplierId),children:(0,be.jsxs)(E.Banner,{kind:'red'===s.tone?'danger':'warn',title:`\u23f0 ${s.text}`,children:["Tap to open the ",s.name," order sheet. Nothing is sent until you press Send."]})},s.supplierId)),v.length?(0,be.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${v.length} recipe card${1===v.length?'':'s'} awaiting your sign-off`,children:[v.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,be.jsx)(V.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,be.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,G.pct1)(c.theo),sub:`Target ${s.targetGp}% \xb7 actual ${(0,G.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,be.jsx)(G.Tile,{testID:"tile-stock",label:"Stock value",value:s.ingredients.length?(0,$.gbp)((0,G.stockValue)(s.ingredients)):'Nothing yet',sub:s.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Items low or out",value:s.ingredients.length?`${k.length}`:'Nothing yet',sub:s.ingredients.length?k.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:k.some(e=>e.onHand<=0)?'red':k.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Waste this week",value:s.waste.length?(0,$.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,G.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,be.jsx)(G.Tile,{label:"Covers forecast today",value:`${h}`,sub:u,onPress:()=>e('kitchen','prep')}):(0,be.jsx)(G.Tile,{label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,be.jsx)(G.Tile,{label:"Orders due today",value:`${y.length}`,sub:y.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:y.some(e=>e.cutPassed)?'red':y.length?'amber':'ok',onPress:()=>e('orders')})]}),x.map(e=>(0,be.jsxs)(E.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),j.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,be.jsx)(E.Banner,{kind:"info",title:`${j.length} deliver${1===j.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${C.length} dishes below ${s.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,be.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ie.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([s,t])=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:s,onPress:()=>'creator'===t?e('creator'):e('kitchen',t),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,be.jsxs)(E.T,{weight:"semibold",children:[s," \u203a"]})},t))}),(0,be.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"})]})}},805,[1231,1119,918,1232,990,991,993,2,1003,994,995,959,818,921,1292,1293,950,1002,920,1000,1001,924,1296,30,233,122,263,151,287,127,289,861,925,813,816,821,927,1300,1304,1307,1308,1335,1336,938,1337,1007,922,1008,1010,1009,1343,989,953,859,1011,1344,1012,1348,932,1356,934,997,998,819,1357,820,1006,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return s}}),_e.isAllowedPath=function(e,n=c){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||f[n].test(e))},_e.canShow=function(e,t=c){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=['owner','staff','customer','display','chef'].includes(u)?u:'owner',s={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},f={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},806,[5,408]);
+__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return p}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),p=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text))},807,[]);
+__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},808,[]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},809,[815]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},810,[877,30,122,127,24]);
+__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},811,[]);
+__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),e.canEditBooking=function(t){return'customer'!==t.variant&&('staff'===t.variant||t.inStaffApp?!!t.shiftManager:'display'===t.variant||'chef'===t.variant||'staff'!==t.role)},Object.defineProperty(e,"isWixBooking",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EDIT_FIELDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"FIELD_WORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"draftOf",{enumerable:!0,get:function(){return c}}),e.changedFields=f,e.editPatch=function(t,n,o,s=(new Date).toISOString()){const d=f(t,n);if(!d.length)return{};const l={};for(const t of d){const o=u(t,n[t]);l[t]='partySize'===t?Math.max(1,Math.min(200,o)):'phone'===t||'email'===t||'table'===t?o||void 0:o}d.includes('table')&&(l.tableSetHere=!0);const c=t;return l.locallyEdited=!0,l.editedFields=[...new Set([...c.editedFields??[],...d])],l.editLog=[...c.editLog??[],{at:s,by:o.by.slice(0,80),app:o.app,fields:d}].slice(-50),l},e.editWarnings=function(n,o,s,d,l=90){const c=[],u={...n,date:o.date,time:o.time,partySize:o.partySize};if(o.table){const n=(0,t.tableOverlaps)(u,o.table,s.filter(t=>t.date===o.date),l);n.length&&c.push(`The table already has a booking at about the same time: ${n.map(t=>`${t.time} ${t.walkIn?'walk-in':t.name}`).join(', ')}.`)}d&&c.push(`Bookings are paused ${d.from} to ${d.to}${d.reason?` (${d.reason})`:''}.`);return c},Object.defineProperty(e,"editedWords",{enumerable:!0,get:function(){return b}});var t=r(_d[0]);const n='For example: birthday, high chair, dog, window seat',o='This booking came from the website. Changes here are not sent to website bookings yet.';const s=t=>{const n=t;return'Wix'===n.importedFrom||!!n.wix||(t.tags??[]).includes('Wix')},d=['date','time','partySize','name','phone','email','notes','table'],l={date:'date',time:'time',partySize:'covers',name:'name',phone:'phone',email:'email',notes:'notes',table:'table'},c=t=>({date:t.date,time:t.time,partySize:t.partySize,name:t.name,phone:t.phone??'',email:t.email??'',notes:t.notes??'',table:t.table??''}),u=(t,n)=>'partySize'===t?Number(n):String(n??'').trim();function f(t,n){const o=c(t);return d.filter(t=>u(t,o[t])!==u(t,n[t]))}const b=t=>t.map(t=>l[t]).join(', ')},812,[1297]);
+__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return j.webLine}}),_e.T=I,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return W}}),_e.BrandBar=D,_e.Screen=function({children:e,title:t,subtitle:o,back:l=!0,right:n,maxWidth:s=640,footer:u,scroll:b=!0}){const f=(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:e});return(0,w.jsxs)(y.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:(0,w.jsx)(D,{title:t,subtitle:o,back:l,right:n})}),b?(0,w.jsx)(c.default,{contentContainerStyle:{paddingBottom:40},children:f}):(0,w.jsx)(h.default,{style:{flex:1},children:f}),u?(0,w.jsx)(h.default,{style:H.footer,children:(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:u})}):null]})},_e.Button=function({label:e,sub:t,onPress:o,kind:l="primary",disabled:n,small:c,style:u,accessibilityLabel:b,testID:h}){const f={primary:p.colours.gold,secondary:p.colours.tile,danger:p.colours.redSolid,ghost:'transparent',success:p.colours.accentBg}[l],y={primary:p.colours.onGold,secondary:p.colours.text,danger:'#FFFFFF',ghost:p.colours.gold,success:p.colours.goldLight}[l],j={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,w.jsxs)(s.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,accessibilityState:{disabled:!!n},disabled:n,onPress:o,style:({pressed:e})=>[H.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:j,opacity:n?.4:e?.85:1},c&&{paddingVertical:8,paddingHorizontal:14,minHeight:x.control.min,minWidth:44},u],children:[(0,w.jsx)(I,{weight:"semibold",size:c?p.font.small:p.font.body,colour:y,center:!0,children:e}),t?(0,w.jsx)(I,{size:c?p.font.small-2:p.font.small,colour:y,center:!0,testID:h?`${h}-sub`:void 0,children:t}):null]})},_e.Card=function({children:e,style:t,onPress:o,highlight:l}){const n=l===p.colours.gold||l===p.colours.accentBorder,c=(0,w.jsx)(h.default,{style:[H.card,{alignItems:'center'},l?{borderColor:n?p.colours.accentBorder:l,borderWidth:n?1:2}:null,t],children:e});return o?(0,w.jsx)(s.default,{accessibilityRole:"button",onPress:o,style:({pressed:e})=>({opacity:e?.85:1}),children:c}):c},_e.Badge=function({label:e,kind:t="neutral"}){const o={neutral:[p.colours.surface2,p.colours.muted,p.colours.border],gold:[p.colours.goldTint,p.colours.goldLight,p.colours.gold],red:[p.colours.redBg,'#FFD9D4',p.colours.red],amber:[p.colours.amberBg,'#FFE2A8',p.colours.amber],ok:[p.colours.okBg,p.colours.goldLight,p.colours.ok],blue:[p.colours.blueBg,p.colours.goldLight,p.colours.blue]}[t];return(0,w.jsx)(h.default,{style:[H.badge,{backgroundColor:o[0],borderColor:o[2],maxWidth:'100%'}],children:(0,w.jsx)(I,{size:13,weight:"medium",colour:o[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return z}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return P}}),_e.Row=L,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v}}),_e.Field=function({label:e,...o}){return(0,w.jsxs)(h.default,{style:{gap:4,alignSelf:'stretch',width:'100%'},children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,w.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...o,style:[H.input,o.multiline&&{minHeight:70,textAlignVertical:'top'},o.style]})]})},_e.Chip=function({label:e,selected:t,onPress:o,disabled:l,sub:n,testID:c}){return(0,w.jsxs)(s.default,{testID:c,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${e}${n?`, ${n}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:o,style:[H.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e}),n?(0,w.jsx)(I,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:n}):null]})},_e.Toggle=function({value:e,onChange:t,label:o,testID:l,disabled:n,a11y:s}){return(0,w.jsxs)(L,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,w.jsx)(I,{style:{flex:1,flexShrink:1},children:o}),(0,w.jsx)(b.default,{testID:l,disabled:n,accessibilityLabel:s??o,value:e,onValueChange:t,trackColor:{true:p.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:p.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:o=1,max:l=20,label:n,step:c=1,format:u,testID:b}){const f=u?u(e):String(e),y=e=>Math.round(e/c)*c;return(0,w.jsxs)(L,{gap:10,children:[(0,w.jsx)(s.default,{testID:b?`${b}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${n??''}`,disabled:e<=o,onPress:()=>t(Math.max(o,y(e-c))),style:[H.stepBtn,e<=o?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,w.jsx)(h.default,{testID:b?`${b}-value`:void 0,accessibilityLabel:n?`${n}: ${f}`:f,children:(0,w.jsx)(I,{weight:"semibold",size:p.font.large,style:{minWidth:u?64:28,textAlign:'center'},children:f})}),(0,w.jsx)(s.default,{testID:b?`${b}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${n??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,y(e+c))),style:[H.stepBtn,e>=l?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:o,children:u,maxWidth:b,testID:x,footer:j}){const{height:C}=(0,f.default)(),k=l.default.useContext(y.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=Math.max(320,C-k.top-k.bottom-24);return(0,w.jsx)(n.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,w.jsx)(h.default,{style:[H.overlay,{padding:12,paddingTop:12+k.top,paddingBottom:12+k.bottom}],children:(0,w.jsxs)(h.default,{style:[H.sheet,{maxHeight:B},b?{maxWidth:b}:null],testID:x,children:[(0,w.jsxs)(L,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,w.jsx)(T,{style:{flex:1},children:o}),(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:S?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,w.jsx)(I,{size:S?18:24,colour:p.colours.text,children:S?'Close':'\u2715'})})]}),(0,w.jsx)(c.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:u}),j?(0,w.jsx)(h.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:x?`${x}-footer`:void 0,children:j}):null]})})})},_e.SectionTitle=function({children:e}){return(0,w.jsx)(I,{weight:"semibold",size:12,colour:p.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return H}});var t=r(d[0]),o=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),s=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),b=e(r(d[7])),h=e(r(d[8])),f=e(r(d[9])),y=r(d[10]),p=r(d[11]),x=r(d[12]),j=r(d[13]),C=r(d[14]),k=r(d[15]),B=r(d[16]),w=r(d[17]);const S=['kirkton','abbotsford'].includes(C.VENUE_RID);function I({children:e,style:o,size:l=p.font.body,weight:n="regular",colour:s=p.colours.text,numberOfLines:c,center:u,testID:b,accessibilityRole:h}){return(0,w.jsx)(t.Text,{testID:b,accessibilityRole:h,numberOfLines:c,style:[{fontFamily:p.fonts[n],fontSize:l,color:s,lineHeight:(0,x.lineFor)(l)},u&&{textAlign:'center'},o,(0,j.webLine)(o,l)],children:e})}const R=e=>(0,w.jsx)(I,{size:p.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,w.jsx)(I,{size:p.font.large,weight:"semibold",center:!0,...e}),W=e=>(0,w.jsx)(I,{colour:p.colours.muted,size:p.font.small,...e});function D({title:e,back:t=!0,right:l,subtitle:n}){return(0,w.jsxs)(h.default,{style:H.brandBar,children:[(0,w.jsxs)(h.default,{style:H.row,children:[(0,w.jsx)(h.default,{style:H.brandSide,children:t?(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>o.router.canGoBack()?o.router.back():o.router.replace(k.ENTRY[k.APP_VARIANT]),style:H.backBtn,hitSlop:10,children:(0,w.jsx)(I,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,w.jsx)(s.default,{onPress:()=>o.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:H.brandCenter,children:(0,w.jsx)(B.RestaurantBrand,{size:B.HEADER_LOGO})}),(0,w.jsx)(h.default,{style:[H.brandSide,{alignItems:'flex-end'}],children:l?(0,w.jsx)(h.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,w.jsx)(R,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,n?(0,w.jsx)(W,{center:!0,style:{alignSelf:'stretch'},children:n}):null]})}function F({kind:e="info",title:t,children:o}){const n={info:[p.colours.surface,p.colours.gold,p.colours.text],warn:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],danger:[p.colours.redBg,p.colours.red,'#FFE3DF'],success:[p.colours.okBg,p.colours.ok,p.colours.goldLight],example:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],demo:[p.colours.goldTint,p.colours.gold,p.colours.goldLight]}[e];return(0,w.jsxs)(h.default,{accessibilityRole:"summary",style:[H.banner,{backgroundColor:n[0],borderLeftColor:n[1]}],children:[t?(0,w.jsx)(I,{weight:"semibold",colour:n[2],center:!0,children:t}):null,l.default.Children.toArray(o).every(e=>'string'==typeof e||'number'==typeof e)?(0,w.jsx)(I,{size:p.font.small,colour:n[2],center:!0,children:o}):o]})}const z=()=>(0,w.jsx)(F,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),P=()=>(0,w.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function L({children:e,style:t,gap:o=8,wrap:l}){return(0,w.jsx)(h.default,{style:[H.row,{gap:o},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:e})}const v=()=>(0,w.jsx)(h.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const H=u.default.create({row:{flexDirection:'row',alignItems:'center'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:p.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{borderRadius:x.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:x.control.min,alignSelf:'stretch'},card:{backgroundColor:p.colours.surface,borderRadius:p.radius.l,padding:16,borderWidth:1,borderColor:p.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:p.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,backgroundColor:p.colours.surface2,borderColor:p.colours.border,borderWidth:1,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:10,color:p.colours.text,fontSize:p.font.body,fontFamily:p.fonts.regular},chip:{borderWidth:1,borderColor:p.colours.border,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:p.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:p.colours.surface,borderRadius:x.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:p.colours.gold},footer:{borderTopWidth:1,borderTopColor:p.colours.border,backgroundColor:p.colours.surface,padding:12}})},813,[877,804,30,256,263,151,46,271,127,287,289,821,1236,1238,5,806,861,24]);
+__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},814,[]);
+__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{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']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},815,[818]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},816,[]);
+__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.takeawaySlots=function(s,o,r){const l=(0,t.hoursFor)(s,r);if(!l)return[];const d=s.settings.slotMinutes,u=(0,n.addMins)(r,s.settings.leadMins),c=[];for(let t=new Date(l.open);t<=l.close;t=(0,n.addMins)(t,d)){if(tn.restaurantId===s.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;c.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:s.settings.slotCap,full:r>=s.settings.slotCap})}return c},e.bookingSlots=function(r,l,d,u,c){const f=(0,t.hoursFor)(r,l);if(!f)return[];const p=[],M=(0,n.addMins)(f.close,-60),h=(0,s.lastFoodOn)(r,o(l)),k=h?(0,n.addMins)((0,n.atTime)(l,h.time),-60):M,S='drinks'===(0,s.afterLastFood)(r);for(let t=new Date(f.open);t<=M;t=(0,n.addMins)(t,30)){const s=(0,n.hm)(t),o=t>k;if(o&&!S)continue;const l=r.settings.bookingCoversPerSlot-d(s),f=t.getTime()=u,...o?{drinksOnly:!0}:{}})}return p};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]);const o=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},817,[815,818,809]);
+__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},818,[]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},819,[1239,1021]);
+__d(function(_g,_r2,_i2,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteRefusal",{enumerable:!0,get:function(){return p.inviteRefusal}}),Object.defineProperty(_e,"keysToWipe",{enumerable:!0,get:function(){return p.keysToWipe}}),Object.defineProperty(_e,"changedFields",{enumerable:!0,get:function(){return m.changedFields}}),Object.defineProperty(_e,"useSync",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return ue}}),_e.setTempManagerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return i?{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'}:(P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'manager',managerAccess:!0}:{role:'staff',managerAccess:void 0}}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setTempOwnerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});if(i)return{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'};const n=e=>'Manager'===e.level||'Supervisor'===e.level?'manager':'staff';return P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'owner',ownerAccess:!0}:{role:a.managerAccess?'manager':n(a),ownerAccess:void 0}}:a)})),{ok:!0}}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setManagerAccess=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:i}=await ne().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(i)return{ok:!1,message:i.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=String(s??'');return P.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...Ge(n)}:t)})),{ok:!0,role:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.unlockCashUp=async function(e,t,a){if(H.PITCH)return Q.unlockCashUp(e,t,a);const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:i,error:n}=await ne().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(n)return{ok:!1,message:n.message};const r=String(i);return'cashup'===e?B.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):B.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.readCashAudit=async function(e){if(H.PITCH)return Q.cashAudit(e);const t=re.getState().venueId;if(!t)return[];let a=ne().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:i}=await a;return i||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,m.changedFields)(e.old_row,e.new_row)}))},_e.setPushLive=async function(e){const t=re.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await ne().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(qt.setState({live:!!a,known:!0}),{ok:!0})},_e.readPushLive=Kt,_e.readAccessLog=async function(){const e=re.getState().venueId;if(!e)return[];try{const{data:t}=await ne().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(_e,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return xt}}),_e.uploadOrderLogo=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),i=`${a}/${e}-${Date.now()}.jpg`,{error:n}=await ne().storage.from(xt).upload(i,s,{upsert:!0,contentType:'image/jpeg'});return n?{ok:!1,message:n.message}:{ok:!0,path:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.orderLogoUrl=async function(e){const t=Lt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await ne().storage.from(xt).createSignedUrl(e,3600);if(t?.signedUrl)return Lt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.removeOrderLogo=async function(e){try{await ne().storage.from(xt).remove([e])}catch{}},Object.defineProperty(_e,"usePushLive",{enumerable:!0,get:function(){return qt}}),_e.claimInvite=Zt,_e.signedInHereAs=async function(e){fe();const t=await k.kv.get(Ht,null);return!!t&&'staff'===t.kind&&t.staffRef===e},_e.rememberedInviteHere=async function(e){return fe(),await k.kv.get(Gt,null)===e},_e.kirkmichaelStaffAppUrl=async function(){const t=re.getState();if(!e.IS_KIRKMICHAEL||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.wildingsStaffAppUrl=async function(){const t=re.getState();if(!e.IS_WILDINGS||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.forgetSignInHere=async function(){fe(),await k.kv.remove(Ht),await k.kv.remove(Gt),oe({mode:'signin',perms:[]});try{await ta()}catch{}},_e.approveShiftSwap=async function(e,t,a){const s=re.getState().venueId;if(H.PITCH||!s||'staff'!==re.getState().kind)return{ok:!0};if(!(0,$.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Yt('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},_e.claimInviteForSync=async function(e){const t=await Zt(e);return'ok'===t.status?t.id:null},_e.reissueInvite=async function(e){if(H.PITCH)return Q.reissueInvite(e);const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await ne().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=a,n=String(i.app??'staff');return{ok:!0,token:String(i.token),expiresAt:String(i.expiresAt),app:'owner'===n||'chef'===n?n:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.ensureStaffAppLinks=async function(e){const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)throw new Error('Connect to the venue first.');return Yt('ensure_staff_app_links',{p_venue:t,p_staff_ref:e})},_e.staffAppLinkHistory=async function(e){return Yt('staff_app_link_history',{p_venue:re.getState().venueId,p_staff_ref:e})},_e.revokeStaffAppLink=async function(e){await Yt('revoke_staff_app_link',{p_venue:re.getState().venueId,p_link_id:e})},_e.readInviteStatus=async function(){if(H.PITCH)return Q.inviteStatus();const e=re.getState().venueId;if(!e)return{};const{data:t,error:a}=await ne().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},_e.pairWithCode=async function(t){if(!(0,v.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_pairing_code':e.IS_GREENSIDE?'claim_greenside_pairing_code':e.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':e.IS_KIRKTON?'claim_kirkton_pairing_code':e.IS_WILDINGS?'claim_wildings_pairing_code':e.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':e.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:t});if(s)throw s;const i=a?.[0];if(!i)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,canWrite:i.can_write,label:i.label};return await k.kv.set(Vt,n),aa(),{ok:!0,venueName:i.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},_e.unpairDisplay=async function(){await k.kv.remove(Vt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},_e.disconnectStaff=async function(){await k.kv.remove(Ht),await k.kv.remove(Gt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},_e.wipeThisDevice=async function(t={}){try{await ta()}catch{}try{(0,v.isSupabaseConfigured)()&&await ne().auth.signOut({scope:'local'})}catch{}let a=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const t of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(t)try{const s=[];for(let e=0;et.startsWith(`cc-venue:${e.VENUE_RID}:`)):(0,p.keysToWipe)(s).filter(e=>!e.startsWith('cc-venue:')))t.removeItem(i),a++}catch{}try{const t='undefined'!=typeof caches?caches:null;if(t)for(const a of await t.keys())!e.IS_ISOLATED_VENUE&&/data|api|photo/i.test(a)&&await t.delete(a)}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==t.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return a},_e.guestSession=Xt,Object.defineProperty(_e,"rpc",{enumerable:!0,get:function(){return Yt}}),_e.startAppSync=async function(t=e.VENUE_RID){if(e.IS_ISOLATED_VENUE&&t!==e.VENUE_RID)return;if(ge)return;ge=!0,sa=t,'customer'===le&&'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(fe(),'customer'!==le){const e=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===le&&(0,d.isAnchorage)(t)?[U.useStore,P.useOwner,L.useKitchen,q.useSafety,N.useCardStore,r.useGpCalc,M.useOrderSheets,o.useSpecials,_.useHr]:[U.useStore,P.useOwner,L.useKitchen];if(await Promise.all(a.map(e)),'chef'===le&&(0,d.isAnchorage)(t)&&a.some(e=>!e.persist.hasHydrated()))return void oe({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await wa(t)}catch{if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(t))return void oe({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,v.isSupabaseConfigured)())return void oe({mode:'off'});R.mutationQueue.subscribe(()=>{const e=R.mutationQueue.waiting,t=e[0];oe({pending:R.mutationQueue.pending.length,failed:R.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,O.describeWrite)(t)}: ${(0,O.plainReason)({...t.lastErr},'retry')}`:void 0})}),R.mutationQueue.onFailed(e=>oe({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:R.mutationQueue.failed.length,refused:{what:(0,O.describeWrite)(e),why:'conflict'===e.reason?(0,O.plainReason)({code:'conflict'},'refused'):(0,O.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),me.push((0,b.onConnectivity)(e=>oe({mode:e?re.getState().venueId?'live':re.getState().mode:re.getState().venueId?'offline':re.getState().mode}))),await ia()},Object.defineProperty(_e,"syncInternals",{enumerable:!0,get:function(){return fa}}),_e.goLive=ma,Object.defineProperty(_e,"usePublicDayStore",{enumerable:!0,get:function(){return Ca}}),_e.publicDay=function(e,a){const s=`${e}|${a}`,i=Ea.get(s);if('customer'!==le||!(0,v.isSupabaseConfigured)())return null;(!i||Date.now()-i.at>6e4)&&(i?i.at=Date.now():Ea.set(s,{at:Date.now(),v:{bookings:[],blocks:[]}}),Yt('public_day',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_date:a}).then(t=>{const i=[],n=[];(t??[]).forEach((t,s)=>{'booking'===t.kind?i.push({id:`pub-${a}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:a,time:ye(t.booking_time),partySize:Number(t.covers)||0,table:(t.table_ids??[]).join('+')||void 0,durationMins:t.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):n.push({id:`pubblk-${a}-${s}`,rid:e,date:a,from:ye(t.from_time),to:ye(t.to_time),areaId:t.area_id??void 0,tables:Array.isArray(t.table_ids)&&t.table_ids.length?t.table_ids.map(String):void 0,by:'',createdAt:''})}),Ea.set(s,{at:Date.now(),v:{bookings:i,blocks:n},ok:!0}),Ca.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ea.get(s);e&&!e.ok&&Ea.delete(s)}));const n=Ea.get(s);return n?.ok?n.v:null};var e=_r2(_d[0]),t=_r2(_d[1]),a=_r2(_d[2]),s=_r2(_d[3]),i=_r2(_d[4]),n=_r2(_d[5]),r=_r2(_d[6]),o=_r2(_d[7]),d=_r2(_d[8]),u=_r2(_d[9]),l=_r2(_d[10]),c=_r2(_d[11]),f=_r2(_d[12]),p=_r2(_d[13]),m=_r2(_d[14]),g=_r2(_d[15]),_=_r2(_d[16]),S=_r2(_d[17]),h=_r2(_d[18]),y=_r2(_d[19]),w=_r2(_d[20]),v=_r2(_d[21]),b=_r2(_d[22]),k=_r2(_d[23]),I=_r2(_d[24]),O=_r2(_d[25]),R=_r2(_d[26]),A=_r2(_d[27]),U=_r2(_d[28]),D=_r2(_d[29]),E=_r2(_d[30]),C=_r2(_d[31]),T=_r2(_d[32]),N=_r2(_d[33]),M=_r2(_d[34]),K=_r2(_d[35]),x=_r2(_d[36]),L=_r2(_d[37]),q=_r2(_d[38]),P=_r2(_d[39]),$=_r2(_d[40]),j=_r2(_d[41]),B=_r2(_d[42]),F=_r2(_d[43]),W=_r2(_d[44]),V=_r2(_d[45]),H=_r2(_d[46]),G=_r2(_d[47]),Q=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(G),J=_r2(_d[48]),z=_r2(_d[49]),Z=_r2(_d[50]),X=_r2(_d[51]),Y=_r2(_d[52]),ee=_r2(_d[53]),te=_r2(_d[54]),ae=_r2(_d[55]),se=_r2(_d[56]),ie=_r2(_d[57]);const ne=()=>(0,w.getSupabase)();R.mutationQueue.setExecutor(I.executeMutation);const re=(0,y.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),oe=e=>re.setState(e),de=e=>{const t=re.getState().perms;return t.includes('*')||t.includes(e)},ue=()=>{const e=re.getState().mode;return'live'===e||'offline'===e||'connecting'===e};re.subscribe(()=>(0,ae.setLiveData)(ue()));let le=D.APP_VARIANT,ce=!1;const fe=()=>{ce||((0,k.setSyncNamespace)(le),ce=!0)};let pe=[],me=[],ge=!1;const Se=()=>(new Date).toISOString().slice(0,10),he=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),ye=e=>e?e.slice(0,5):'',we=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],ve=e=>JSON.parse(JSON.stringify(e));function be(e,t){const a=he(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>U.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=ve(e);return t?{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s}:{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};return!t&&a.status&&'declined'!==a.status&&(s.status=a.status),t&&(s.walkIn=!0),'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.bookings.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{bookings:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function ke(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>U.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:ve(e.lines??[]),allergies:we(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:ve(e.allergyChain??{}),readiness:ve(e.readiness??{}),allergy_ticks:ve(e.allergyTicks??{}),handover_check:e.handoverCheck?ve(e.handoverCheck):null,accepted:e.accepted?ve(e.accepted):null,doc:ve(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.orders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ie(e){const t=he(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...E.useBlocks.getState().blocks,...E.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:ve(e)}),fromRow:t=>t.doc?{...t.doc,id:String(t.id),rid:e}:{id:String(t.id),rid:e,date:t.block_date,from:ye(t.from_time),to:ye(t.to_time),reason:t.reason??void 0,note:t.note??void 0,by:t.created_by??'',createdAt:t.created_at,areaId:t.area_id??void 0,areaName:t.area_name??void 0},apply:(e,t)=>E.useBlocks.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id)),o=[...n,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>E.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Oe=null;function Re(e){const t=e=>ve({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(C.useFloor.getState().plans[e]??(0,C.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>de('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Oe??(0,se.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:re.getState().staffRef??le}),fromRow:e=>(Oe=String(e.id),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,ie.withSeedBest)(e,t[0]):void 0;a&&C.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>C.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ae(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>T.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>de('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,$.isUuid)(e.supplierId)?e.supplierId:(0,se.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...e.supplier_id?{supplierId:(t=String(e.supplier_id),Le.get(t)??t)}:{}};var t},apply:(t,a)=>T.useShellStore.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!i.has(e.key)).map(e=>n.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ue=new Set;function De(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>T.useShellStore.getState().events.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.id)&&!!(T.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==re.getState().kind&&('device'!==re.getState().kind||de('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,$.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ue.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>T.useShellStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.events.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function Ee(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(T.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...T.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;T.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ue]}}}))},afterRead:()=>{T.useShellStore.getState().server[e]||T.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ue]}}}))},subscribe:()=>()=>{}}}const Ce=new Set;function Te(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=U.useStore.getState().menu;return N.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.card.id)&&!((0,d.isAnchorage)(e)&&(0,d.isDemoCard)(t.card)),writable:()=>de('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,d.isAnchorage)(e)&&(s={...s,signOff:(0,d.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,d.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const i=t.item&&(0,d.isAnchorage)(e)&&(0,d.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,se.photoPath)(a,s),t=Ne(s.photo);t&&((0,N.cachePhotoAs)(e,t),Me(e,t)),s={...s,photo:e}}const{row:n,extra:r}=(0,se.cardToRow)(s,a);return{...n,...r,doc:ve({card:s,item:i})}},fromRow:t=>{const a=t.doc;if(!a?.card)return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,d.isAnchorage)(e)&&(0,d.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!de('recipes.edit')&&t.length){const e=new Set(t);N.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);N.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),i=new Set(e.map(e=>e.card.menuItemId)),n=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!i.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return n.length&&U.useStore.setState(e=>({menu:e.menu.map(e=>n.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...n]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})},subscribe:e=>{const t=N.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=U.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Ne=e=>(0,N.readLocalPhoto)(e);async function Me(e,t){if(!Ce.has(e)){Ce.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await ne().storage.from(se.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Ce.delete(e),oe({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const Ke=new Map,xe=(0,y.create)(()=>({n:0}));(0,N.setStoragePhotoResolver)(e=>{const t=Ke.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,v.isSupabaseConfigured)()&&'off'!==re.getState().mode?(t||(Ke.set(e,{url:'',at:Date.now()}),ne().storage.from(se.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(Ke.set(e,{url:t.signedUrl,at:Date.now()}),xe.setState(e=>({n:e.n+1})),N.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Le=new Map;const qe=(e,t)=>{const a=(0,$.isUuid)(t)?t:(0,se.uuidFrom)(`sup:${e}:${t}`);return Le.set(a,t),a};function Pe(e){return{name:'order_sheets',table:'suppliers',list:()=>M.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,d.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:qe(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:ve(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Le.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>M.useOrderSheets.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!i.has(e.id)).map(e=>n.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>M.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,$.isUuid)(e)?e:(0,se.uuidFrom)(`sup:${re.getState().venueId}:${e}`)})}}let $e=!1,je=!1;const Be=new Map,Fe=new Map,We=new Map,Ve=new Map,He=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',Ge=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},Qe=(e,t)=>t&&'owner'!==e.role&&'manager'!==e.role?{role:'manager',level:e.level,managerAccess:!0}:{...e,managerAccess:void 0},Je=e=>ve({id:e.id,name:e.name,role:e.role,job:e.job,active:e.active,level:e.level??Ge(He(e)).level,dept:e.dept??'',nickname:e.nickname,displayClock:e.displayClock,temp:e.temp,tempUntil:e.tempUntil,managerAccess:e.managerAccess||void 0,ownerAccess:e.ownerAccess||void 0,...e.temp&&e.tempUntil&&e.tempUntil(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'});const Ze=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Xe=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function Ye(){return{name:'rota',table:'rota_shifts',list:()=>P.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&Be.has(e.staffId),writable:()=>de('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Ze());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Xe(e.start),end_time:Xe(e.end),published:!!e.published,doc:ve(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,i,n]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,i-1,n).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.shifts.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{shifts:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function et(){const t=he(62),a=e=>de('rota.manage')||e.staffId===re.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>P.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&a(e),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('work_date',t),inWindow:e=>e.date>=t,toRow:(t,a)=>({id:t.id,venue_id:a,staff_id:Be.get(t.staffId)??null,staff_ref:t.staffId,work_date:t.date,clock_in:t.in??null,clock_out:t.out??null,breaks:ve(t.breaks??[]),break_mins:t.breakMins??0,doc:ve((0,u.privateAttendance)(e.VENUE_RID,t))}),fromRow:t=>{if(!t.doc)return null;const a=(0,u.privateAttendance)(e.VENUE_RID,{...t.doc,id:String(t.id)});return'confirmed'===t.status?a.signOff={by:String(t.confirmed_by_name??a.signOff?.by??'Manager'),byId:a.signOff?.byId??'',at:t.confirmed_at?new Date(t.confirmed_at).toISOString():a.signOff?.at??''}:delete a.signOff,a},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.attendance.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{attendance:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function tt(){const e=he(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>P.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.staffId===re.getState().staffRef&&'open'===e.status,writable:()=>'staff'===re.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,$.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:ve({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function at(t){P.timesheetRemote.send=(a,s)=>{if(!de('rota.manage')||!(0,$.isUuid)(s.id))return!1;if('time_request_resolve'===a){const e=s;return R.mutationQueue.enqueue({table:'time_requests',venueId:t,kind:'rpc',fn:a,rowKey:e.id,values:{p_id:e.id,p_status:e.status,p_doc:ve(e)}}),!0}const i=s;if('attendance_confirm'===a)return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:a,rowKey:i.id,values:{p_id:i.id,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0;if(!i.in)return!1;const n=i.adjusted?.reason??'';return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:'attendance_override',rowKey:i.id,values:{p_id:i.id,p_venue:t,p_staff_ref:i.staffId,p_work_date:i.date,p_clock_in:i.in,p_clock_out:i.out??null,p_break_mins:i.breakMins??0,p_breaks:ve(i.breaks??[]),p_reason:n,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0},me.push(()=>{P.timesheetRemote.send=null})}function st(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>U.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,$.isUuid)(a)?a:(0,se.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,$.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:ve(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>U.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const it=e=>U.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function nt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));U.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function rt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=U.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[ve({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:C.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:it(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>de('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...dt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...dt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...dt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ot??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ot=t.feature_flags??{},dt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),ve({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const s=t[0];s&&(U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&s.restaurant?(0,a.withWildingsAddress)({...s.restaurant,id:e,settings:{...s.restaurant.settings,games:s.games}}):t),msgTemplates:{...t.msgTemplates,[e]:s.msgTemplates??{}}})),s.display&&Object.keys(s.display).length&&C.useFloor.setState(t=>({settings:{...t.settings,[e]:s.display}})),s.events&&nt(e,s.events))},subscribe:e=>{const t=U.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=C.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ot=null,dt=null;const ut=()=>new Date(Date.now()-2592e6).toISOString(),lt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Be.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},ct=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Fe.get(e));return 2===t.length&&t[0]&&t[1]?(0,X.dmId)(t[0],t[1]):null},ft=()=>re.getState().perms.includes('*');function pt(){const e=()=>re.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>P.useOwner.getState().chat.filter(e=>(0,$.isUuid)(e.id)).map(e=>ve({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!lt(t.ch)&&(t.from===e()||ft()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',ut()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=ut(),toRow:(e,t)=>{const a=lt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Be.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=ct(String(e.channel));if(!t)return null;const a=e.from_staff?Fe.get(String(e.from_staff)):'system';return a?ve({id:String(e.id),ch:t,from:a,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>P.useOwner.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!i.has(e.id)).map(e=>n.has(e.id)?{...e,...n.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=t.filter(e=>!d.has(e.id)).map(e=>({...e,reactions:{},seenBy:e.from===r?[e.from]:[]}));return{chat:u.length?[...o,...u].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Fe.get(String(t.from_staff)):'system',i=ct(String(t.channel)),n=e();if(!i||!n||s===n||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=P.useOwner.getState();if((r.chatMuted[n]??[]).includes(i))return;if(!(0,X.inChannel)(i,r.staff.find(e=>e.id===n)))return;if((0,Y.soundAllowed)())try{(0,Y.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,u=String(t.body??t.text??'').slice(0,120);(0,c.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}function mt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=S.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:ve(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>S.useReminders.setState(s=>{const i=new Set(a),n={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)n[e]={...(0,h.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};n[e]&&i.has(n[e].id)&&delete n[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!i.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:n,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function gt(e){const t=he(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>S.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.reminderId)&&e.staffRef===re.getState().staffRef,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>S.useReminders.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.done.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function _t(e,t,a,s=()=>!0){const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!i.has(e.id)).map(e=>s(e)&&n.has(e.id)?n.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const St=e=>null==e||''===e?null:Number(e),ht=e=>e.filter(e=>!e.startsWith('data:'));function yt(e){return{name:'cash_ups',table:'cash_ups',list:()=>B.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',he(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:ve(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({cashUps:_t(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function wt(e){return{name:'sales_reports',table:'sales_reports',list:()=>B.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:ve(e.vals),categories:e.categories,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({sales:_t(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function vt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=B.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,B.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:ve({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,B.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>B.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function bt(e){return{name:'day_tips',table:'day_tips',list:()=>B.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',he(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>B.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),i=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...i]}}),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function kt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>B.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:St(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>B.useCashUp.setState(s=>({pot:_t(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function It(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=B.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>de('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>B.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Ot(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>j.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:ve(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>j.useNotifs.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>j.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Rt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=F.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:ve(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>F.useOrderLists.setState(s=>{const i={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))i[e]={...W.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const n=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:i,lists:_t(s.lists,n,a,t=>t.rid===e)}}),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function At(e){const t=()=>de('venue.settings')||de('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>F.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,$.isUuid)(a.id)&&(0,$.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,F.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===re.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...i}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:re.getState().staffRef)||null,doc:ve(i),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Ut(e){const t=he(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>F.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:ve(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({history:_t(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function Dt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=V.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:ve(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>de('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&V.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,u.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>V.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Et(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=J.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,J.libraryRowId)(e),kind:'library',doc:ve({items:s.items,updatedAt:s.updatedAt})});for(const[s,i]of Object.entries(t.people)){const[t,n]=s.split('|');t===e&&i.updatedAt&&a.push({id:(0,J.personRowId)(e,n),kind:'person',staffRef:n,doc:ve({tasks:i.tasks,updatedAt:i.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=P.useOwner.getState().staff.find(e=>e.id===re.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=P.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,z.canEditTasks)(t,a)},writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>J.useDailyTasks.setState(a=>{const s={...a.library},i={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(i[(0,J.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:i}}),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ct(e){const t=he(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>J.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=re.getState();return e.byRef===t.staffRef||de('staff.manage')},writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>J.useDailyTasks.setState(s=>({ticks:_t(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Tt(e,t=!1){const a=he(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ee.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,se.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ee.useSoldOut.setState(s=>{const i=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ee.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{te.autoSync.soldOutRead.add(e)}}}function Nt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>te.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:(0,se.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>te.useSoldOutLinks.setState(s=>{const i=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>te.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{te.autoSync.linksRead.add(e)}}}async function Mt(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:i}=await Promise.race([ne().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return i?!!/fetch|network|Failed/i.test(i.message)&&k.kv.get(a,!1):(k.kv.set(a,!0),!0)}catch{return k.kv.get(a,!1)}}async function Kt(){const e=re.getState().venueId;if(e)try{const{data:t}=await ne().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();qt.setState({live:!!t?.push_live,known:!0})}catch{}}const xt='order-list-logos';const Lt=new Map;const qt=(0,y.create)(()=>({live:!1,known:!1}));async function Pt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('reminders:ok',!1):(k.kv.set('reminders:ok',!0),!0)}catch{return k.kv.get('reminders:ok',!1)}}async function $t(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('chat:ok',!1):(k.kv.set('chat:ok',!0),!0)}catch{return k.kv.get('chat:ok',!1)}}const jt=(e,t)=>ve({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),Bt='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ft(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>_.useHr.getState().questions.filter(t=>t.venue===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>jt(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);_.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),i=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),n=new Set(i.map(e=>e.id));return{questions:[...i,...e.filter(e=>!n.has(e.id))]}})},subscribe:e=>_.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Wt(e,t){const a=(t,a,s)=>{R.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(_.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,i,n)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:i,p_kind:n}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:i}=await ne().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return i?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:i}=await ne().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return i?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await ne().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await ne().from('hr_questions').select(Bt).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||_.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>jt(e,t)))}catch{}}}),me.push(()=>{Object.assign(_.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Vt='pair:v1',Ht='staff:v1',Gt='staff:rejoin:v1';async function Qt(){if('display'===le||'customer'===le||H.PITCH)return'none';const t=await k.kv.get(Gt,null);if(!t)return'none';try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s)return(0,p.inviteRefusal)(s.message)?(await k.kv.remove(Gt),await k.kv.remove(Ht),'refused'):'offline';const i=a?.[0];return i?(await k.kv.set(Ht,{kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name}),'ok'):(await k.kv.remove(Gt),'refused')}catch{return'offline'}}const Jt=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function zt(){fe();const{data:e}=await ne().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await ne().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}oe({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Zt(t){if(H.PITCH)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,v.isSupabaseConfigured)())return{status:'off'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s){const t=(0,p.inviteRefusal)(s.message);if(t){try{localStorage.removeItem((0,e.venueKey)(`cc-pending-invite:${le}`))}catch{}return{status:'refused',message:t}}throw s}const i=a?.[0];if(!i)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name};return await k.kv.set(Ht,n),await k.kv.set(Gt,t),ge&&aa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return oe({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}async function Xt(){if(!(0,v.isSupabaseConfigured)())return!1;try{return await zt(),!0}catch{return!1}}const Yt=async(e,t={})=>{if(H.PITCH)return(0,G.pitchRpc)(e,t);const{data:a,error:s}=await ne().rpc(e,t);if(s)throw s;return a};let ea=null;async function ta(){for(const e of me)try{e()}catch{}me=[],pe.forEach(e=>e.stop()),pe=[],ea&&(clearInterval(ea),ea=null)}async function aa(){await ta(),await ia()}let sa=e.VENUE_RID;async function ia(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const t=sa;try{if(oe({mode:'connecting'}),await R.mutationQueue.load(),'customer'===le)return void await da(t);const a=await k.kv.get(Vt,null);let s=await k.kv.get(Ht,null);if(e.IS_ISOLATED_VENUE&&(a&&!(0,e.venueIdentityAllowed)(a.venueId,a.venueSlug)||s&&!(0,e.venueIdentityAllowed)(s.venueId,s.venueSlug)))return void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:i}=await ne().auth.getSession();if('display'!==le&&s&&!i.session){const e=await Qt();if('offline'===e)return oe({venueId:s.venueId,venueSlug:s.venueSlug,venueName:s.venueName,kind:s.kind,role:s.role,staffRef:s.staffRef,staffUuid:s.staffUuid,mode:'offline'}),void setTimeout(()=>{sa===t&&aa()},6e4);'refused'===e&&s.staffRef&&g.useSession.getState().meId===s.staffRef&&g.useSession.getState().signOut(),s=await k.kv.get(Ht,null),({data:i}=await ne().auth.getSession())}const n='display'===le?a:s;if(!i.session||!n)return void oe({mode:'display'===le?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Yt('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===le?await k.kv.remove(Vt):(await k.kv.remove(Ht),await k.kv.remove(Gt)),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId===n.staffRef&&g.useSession.getState().signOut(),void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'display'===le?'This display was unpaired by a manager.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(e){if(!(0,b.isOnline)()||/fetch|network/i.test(String(e?.message)))oe({mode:'offline'});else if(Jt(e)&&'display'!==le){const{error:e}=await ne().auth.refreshSession();e&&'ok'===await Qt()&&setTimeout(()=>{sa===t&&aa()},500)}r=re.getState().perms}oe({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId!==n.staffRef&&(g.useSession.getState().signIn(n.staffRef),P.useOwner.setState({staffAs:n.staffRef})),await ra(n.venueId,t,n.kind)}catch(e){oe({mode:'local',lastError:String(e?.message??e)})}}const na=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function ra(t,a,s){if(!(0,e.venueIdentityAllowed)(t,a))throw new Error('Different venue: sync refused.');await ma(a),me.push(Da(t));try{const{data:e}=await ne().from('roles').select('id,key').eq('venue_id',t);for(const t of e??[])We.set(t.key,t.id),Ve.set(t.id,t.key)}catch{}const i=[rt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>P.useOwner.getState().staff.map(Je),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>de('staff.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,external_ref:e.id,display_name:e.name,...$e?{nickname:e.nickname?.trim()||null}:{},job_title:e.job||null,department:e.dept||null,active:e.active,...je?{display_clock:!!e.displayClock,temp:!!e.temp,temp_until:e.tempUntil||null}:{},...e.managerAccess||e.ownerAccess||!We.get(He(e))?{}:{role_id:We.get(He(e))}}),fromRow:e=>e.external_ref?(Be.set(String(e.external_ref),String(e.id)),Fe.set(String(e.id),String(e.external_ref)),Oa.set(String(e.external_ref),e.avatar_path??null),ve({id:String(e.external_ref),name:e.display_name,...$e&&'nickname'in e?{nickname:e.nickname??void 0}:{},job:e.job_title??'',active:!1!==e.active,dept:e.department??'',...je&&'display_clock'in e?{displayClock:!!e.display_clock,temp:!!e.temp||void 0,tempUntil:e.temp_until??void 0}:{},...Qe(Ge(Ve.get(String(e.role_id))),!0===e.manager_access),...!0===e.owner_access&&'owner'!==Ge(Ve.get(String(e.role_id))).role?{role:'owner',ownerAccess:!0}:{}})):null,apply:e=>P.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),i=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!i.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ua()},onRemote:()=>{Ua()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=P.useOwner.getState(),t=x.useSetup.getState().sites[sa]?.staffGrade??{};return e.staff.filter(e=>Be.has(e.id)).map(a=>ve({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Be.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?ve({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>P.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=x.useSetup.getState().sites[sa],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&x.useSetup.getState().patch(sa,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=P.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=x.useSetup.subscribe((t,a)=>{t.sites[sa]?.staffGrade!==a.sites[sa]?.staffGrade&&e()});return()=>{t(),a()}}},be(a,!1),be(a,!0),Ie(a),Re(a),ke(a),Ae(a),De(a),Ee(a),Pe(a),{name:'supplier_directory',table:'suppliers',list:()=>P.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:ve(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.suppliers.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{suppliers:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>P.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId),writable:()=>de('suppliers.order')||de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Se(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:ve(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Te(a),ba(a)];de('wages.view')&&i.push(ka(a)),'staff'===s&&(i.push(Ye(),et(),tt(),st(a)),at(t));const n='staff'===s&&await $t();if(Z.useChatSync.setState({synced:n,checked:!0}),me.push(()=>Z.useChatSync.setState({synced:!1})),n&&i.push(pt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(X.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Be.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Be.get(e.id),include:e.include}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>X.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>X.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Mt('hr_questions')&&(i.push(Ft(a)),na.add('hr_questions'),Wt(t,a)),'guest'!==s&&await Mt('sold_out_items')?(i.push(Tt(a,await Mt('sold_out_items','auto'))),na.add('sold_out_items')):te.autoSync.soldOutRead.add(a),'guest'!==s&&await Mt('sold_out_links')?(i.push(Nt(a)),na.add('sold_out_links')):te.autoSync.linksRead.add(a),S.useReminders.getState().ensure(a),'guest'!==s&&await Pt()&&(i.push(mt(a)),'staff'===s&&i.push(gt(a))),j.useNotifs.getState().ensure(a),F.useOrderLists.getState().ensure(a),'staff'===s){$e=await Mt('staff','nickname'),je=await Mt('staff','display_clock');const[e,t,s,n]=await Promise.all([Mt('scheduled_notifications'),Mt('order_lists'),Mt('venue_clock_area'),Mt('daily_tasks')]);J.useDailyTasks.getState().ensure(a),n&&(i.push(Et(a),Ct(a)),na.add('daily_tasks'),na.add('daily_task_ticks')),e&&(i.push(Ot(a)),Kt()),t&&i.push(Rt(a),At(a),Ut(a)),s&&i.push(Dt(a));for(const[a,i]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&na.add(i)}if('guest'!==s&&await Mt('day_tips')){i.push(bt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])na.add(e);await Mt('tips_pot_events')&&i.push(kt(a),It(a)),'staff'===s&&(i.push(yt(a),wt(a),vt(a)),na.add('cash_ups'),na.add('sales_reports'),_r2(_d[59])(_d[58],_d.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(i.push(Ye(),et()),await Mt('scheduled_notifications')&&i.push(Ot(a)));let r=!1;const o={onActivity:()=>oe({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>oe({lastError:`${e}: ${t}`}),onSuspect:(e,s)=>{oe({lastError:`${e}: held back, ${s}`}),r||(r=!0,(async()=>{try{if(!(await Yt('whoami')??[]).some(e=>e.venue_id===t))return void(sa===a&&aa());for(const a of pe){if(a.spec.name!==e)continue;const{count:s,error:i}=await ne().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',t);!i&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{r=!1}})())}};pe=i.map(e=>new A.EntityBridge(e,t,o)),await Promise.all(pe.map(e=>e.start()));const d=async()=>{if('staff'===s&&(0,b.isOnline)())try{const e=await Yt('whoami');if(!e?.some(e=>e.venue_id===t))return void(sa===a&&aa())}catch(e){if(Jt(e)){const e=await Qt();return void('ok'!==e&&'refused'!==e||sa===a&&aa())}}let e=0;for(const[t,a]of pe.entries()){const s='chat'===i[t]?.name;try{await a.read(),e++,s&&Z.useChatSync.getState().error&&Z.useChatSync.setState({error:void 0})}catch(e){const t=String(e?.message??e);if((s||/fetch|network|Failed/i.test(t))&&Z.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(e?(oe({mode:(0,b.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),R.mutationQueue.flush()):oe({mode:'offline'}),!de('wages.view')){const e=re.getState().staffRef;P.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await d();const u=new Map;for(const e of pe)u.set(e.spec.table,[...u.get(e.spec.table)??[],e]);const l=[...u.keys()].filter(e=>na.has(e)).map(e=>({table:e,venueColumn:u.get(e)[0].spec.venueColumn}));let c=!1;const f=(0,A.venueChannel)(t,l,(e,t,a)=>{for(const s of u.get(e)??[])s.remote(t,a);oe({lastSyncAt:(new Date).toISOString()})},e=>{oe({realtime:e}),'SUBSCRIBED'===e?(c&&d(),c=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(c=!0)});me.push(()=>{ne().removeChannel(f)}),ea=setInterval(()=>{d()},6e4),me.push((0,b.onConnectivity)(e=>{e&&d()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...re.getState(),queue:R.mutationQueue.pending.map(e=>e.table),failedTables:R.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const oa='guest:sent:v1';async function da(s){oe({kind:'guest',venueSlug:s,perms:[]});try{const i=(await Yt('public_venue',{p_venue_slug:(0,t.queuedDatabaseSlug)(s)}))?.[0];if(i&&(!e.IS_ISOLATED_VENUE||i.id===e.VENUE_UUID)){oe({venueId:i.id,venueName:i.name}),await ma(s);const e=i.app?.restaurant;e&&U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===s?(0,a.withWildingsAddress)({...e,id:s}):t)})),nt(s,i.app?.events)}await ua(s),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{oe({mode:(0,b.isOnline)()?'local':'offline'})}const i=setInterval(()=>{ua(s).catch(()=>{})},6e4);me.push(()=>clearInterval(i)),e.IS_ISOLATED_VENUE||await la(s)}async function ua(e){const a=await Yt('public_menu',{p_venue_slug:(0,t.queuedDatabaseSlug)(e)})??[];if(a.length){const t=new Map(a.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));N.useCardStore.setState(a=>({cards:a.cards.map(a=>{if(a.restaurantId!==e)return a;const s=t.get(a.menuItemId);if(!s)return a.signOff?{...a,signOff:null}:a;const i=s.updated_at?new Date(s.updated_at).toISOString():a.updatedAt;return{...a,photo:s.photo_url||void 0,signOff:a.signOff??{by:'Head chef',at:i}}})}))}const s=a.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})}async function la(e){let a=await k.kv.get(oa,{}),s=!1;const i=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!s){s=!0;try{const s=U.useStore.getState(),n=s.bookings.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!t.walkIn&&!a[t.id]&&t.createdAt>=i),r=s.orders.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!a[t.id]&&t.createdAt>=i&&'table'!==t.type);if(n.length||r.length){if(!await Xt())return;for(const s of n)try{const i=(await Yt('guest_create_booking',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_booking:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}))?.[0];a={...a,[s.id]:'booking'};const n={};i?.status&&i.status!==s.status&&(n.status=i.status),'string'==typeof i?.ref&&i.ref&&i.ref!==s.ref&&(n.ref=i.ref),Object.keys(n).length&&U.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===s.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Booking: ${e?.message}`}))}for(const s of r)try{await Yt('guest_create_takeaway',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_order:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}),a={...a,[s.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Order: ${e?.message}`}))}await k.kv.set(oa,a)}for(const e of s.bookings)if('booking'===a[e.id]&&'cancelled'===e.status)try{await Yt('guest_cancel_booking',{p_id:e.id}),a={...a,[e.id]:'cancelled'},await k.kv.set(oa,a)}catch{}if(Object.values(a).some(e=>'booking'===e||'order'===e)){const e=await Yt('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));U.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=a.doc??{},i={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return ca(i)===ca(e)?e:i})})),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{oe({mode:(0,b.isOnline)()?re.getState().mode:'offline'})}finally{s=!1}}};me.push(U.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),ea=setInterval(()=>{n()},15e3),n()}const ca=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),fa={bridges:()=>pe,restart:aa},pa='golive:v1:';async function ma(e){'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)?await wa(e):(await k.kv.get(pa+e,!1)||await wa(e),await k.kv.get(ha+e,!1)||(ya(e),await k.kv.set(ha+e,!0)),await k.kv.get(ga+e,!1)||(Sa(),await k.kv.set(ga+e,!0)))}const ga='golive:v3:';function Sa(){const e=e=>JSON.stringify(e).includes('(example)');try{L.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const ha='golive:v2:';function ya(e){const t=e=>JSON.stringify(e).includes('(example)');U.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),P.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function wa(e){if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)){const t=(0,i.stripCoreLiveSamples)(U.useStore.getState()),a=(0,L.stripKitchenExamples)(L.useKitchen.getState()),o=P.useOwner.getState(),u=(0,i.stripOwnerLiveSamples)(o),l={accidents:q.useSafety.getState().accidents.filter(e=>!(0,q.isSeedAccident)(e))},c=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));c(U.useStore.getState(),t)&&(await(0,n.archiveChefCache)('core',U.useStore.getState()),U.useStore.setState(t)),c(L.useKitchen.getState(),a)&&(await(0,n.archiveChefCache)('kitchen',L.useKitchen.getState()),L.useKitchen.setState(a)),c(o,u)&&(await(0,n.archiveChefCache)('owner',o),P.useOwner.setState(u)),c(q.useSafety.getState(),l)&&(await(0,n.archiveChefCache)('safety',q.useSafety.getState()),q.useSafety.setState(l));const f=(0,_.stripHrSamples)(_.useHr.getState());c(_.useHr.getState(),f)&&(await(0,n.archiveChefCache)('hr',_.useHr.getState()),_.useHr.setState(f));const p=(0,r.stripGpSamples)(r.useGpCalc.getState());c(r.useGpCalc.getState(),p)&&(await(0,n.archiveChefCache)('gp',r.useGpCalc.getState()),r.useGpCalc.setState(p));const m=M.useOrderSheets.getState(),g={sheets:{...m.sheets,anchorage:(m.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};c(m,g)&&(await(0,n.archiveChefCache)('order-sheets',m),M.useOrderSheets.setState(g));const S=N.useCardStore.getState(),h={cards:S.cards.filter(e=>!(0,s.isLiveVenue)(e.restaurantId)||!(0,d.isDemoCard)(e)),log:S.log.filter(e=>!(0,d.demoActor)(e.by))};return c(S,h)&&(await(0,n.archiveChefCache)('recipe-cards',S),N.useCardStore.setState(h)),void await k.kv.set(pa+e,!0)}const t=t=>t.restaurantId===e&&!(0,$.isUuid)(t.id);U.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),E.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,$.isUuid)(t.id))})),C.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),P.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,$.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,$.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,$.isUuid)(e.id)),leave:[],swaps:[]}));try{L.useKitchen.setState(e=>(0,L.stripKitchenExamples)(e))}catch{}P.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,$.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId))}));try{q.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await k.kv.set(pa+e,!0)}const va=(e,t)=>ve({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function ba(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(C.useFloor.getState().live[e]??{}).map(([e,t])=>va(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===re.getState().kind||de('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:re.getState().staffRef??le}),fromRow:e=>va(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>C.useFloor.setState(s=>{const i={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;i[t]=a}for(const e of a)delete i[e];return{live:{...s.live,[e]:i}}}),subscribe:e=>C.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function ka(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(x.useSetup.getState().sites[e]?.grades??x.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>de('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=x.useSetup.getState().sites[e]?.grades??[],i=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)i.set(e.id,e);for(const e of a)i.delete(e);const n=[...i.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));x.useSetup.getState().patch(e,{grades:n})},subscribe:t=>x.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ia='staff-avatars',Oa=new Map;let Ra=!1;const Aa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ua(){if(!Ra){Ra=!0;try{for(const[e,t]of Oa){const a=K.useAvatars.getState().photos[e];if(!t){a?.path&&K.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===re.getState().staffRef)continue;const{data:s,error:i}=await ne().storage.from(Ia).download(t);if(i||!s)continue;const n=await Aa(s);n.startsWith('data:image/')&&K.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:n,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ra=!1}}}function Da(e){const t=async()=>{const t=re.getState().staffRef,a=t?Be.get(t)??re.getState().staffUuid:void 0;if(!t||!a||'staff'!==re.getState().kind)return;const s=K.useAvatars.getState().photos[t];try{const i=Oa.get(t),n=t=>{t&&t.startsWith(`${e}/${a}-`)&&ne().storage.from(Ia).remove([t]).catch(()=>{})};if(!s)return void(i&&(await Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}),Oa.set(t,null),n(i)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void oe({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await ne().storage.from(Ia).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Yt('set_staff_avatar',{p_staff_ref:t,p_path:d}),Oa.set(t,d),i!==d&&n(i),K.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){oe({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:K.useAvatars.getState().photos},s=K.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),de('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==re.getState().staffRef){const e=s[t].path;Oa.set(t,null),Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>ne().storage.from(Ia).remove([e])).catch(()=>{})}});return t(),s}const Ea=new Map,Ca=(0,y.create)(()=>({n:0}))},820,{"0":5,"1":6,"2":1128,"3":833,"4":1129,"5":1132,"6":1148,"7":857,"8":1024,"9":988,"10":996,"11":947,"12":811,"13":1150,"14":1109,"15":859,"16":1151,"17":957,"18":1108,"19":952,"20":863,"21":1096,"22":1197,"23":1196,"24":1198,"25":1200,"26":1095,"27":1092,"28":872,"29":806,"30":824,"31":825,"32":1026,"33":1094,"34":1027,"35":1201,"36":1202,"37":1203,"38":1105,"39":856,"40":1033,"41":956,"42":1093,"43":1004,"44":1206,"45":1207,"46":2,"47":1208,"48":1106,"49":1107,"50":1209,"51":1118,"52":923,"53":918,"54":942,"55":1119,"56":1104,"57":945,"58":1017,"59":28,"paths":{}});
+__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=n.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,o=(255&_)/255,F=Math.max(t,E,o),A=Math.min(t,E,o),l=F-A;if(l<.12)return I;const D=F===t?((E-o)/l+6)%6*60:F===E?60*((o-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const n={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},o={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},F={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},821,[5,1233,1204,1234,1235,1236]);
+__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},822,[239]);
+__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,k=(0,n.ukPhone)(l.phone);if(k.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:k.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},823,[1138,1139,1140]);
+__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return f}}),_e.blockedTablesAt=m,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return p}}),_e.closedAreasAt=function(e,t,o,n){const s=(0,l.toMins)(n),a=v(e,t,o).filter(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).map(e=>e.areaId);return new Set([...a,...[...m(e,t,o,n)].map(p)])},_e.blockAt=M,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,l.toMins)(e.to)>(0,l.toMins)(n))).sort((e,t)=>e.date===t.date?(0,l.toMins)(e.from)-(0,l.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{const o={...t,id:(0,s.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,s.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)})),remove:(t,o)=>e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e}),put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}})),f=e=>!e.areaId&&!e.tables?.length;function m(e,t,o,n){const s=(0,l.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).flatMap(e=>e.tables))}const k=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&f(e)).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),v=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),p=e=>`tbl:${e}`;function M(e,t,o,n){const s=(0,l.toMins)(n);return k(e,t,o).find(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to))}const O=(e,t,o,n)=>M(e,t,o,n),y=e=>e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,A=(e,t)=>{const o=b(e=>e.blocks);return k(o,e,t)}},824,[808,1116,1033,952,1117,818]);
+__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=function(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return v}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];const v=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},825,[5,808,1116,946,952,1117,945]);
+__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===O(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),O=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>S(o,t)>=-20),T=v?Math.round(S(o,v)):void 0,w=O?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':O?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&void 0!==T&&T<=45&&(j='soon'):j='blocked';const A=O,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,S=new Set((0,a.bestTables)(s));let O=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&S.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()
i.getTime())),y=new Set((0,a.bestTables)(s)),S=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||S(t)-S(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))};var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Free',...n},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&S(a,t)<=45&&-S(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},S=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,O=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))}},826,[825,945,828]);
+__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l})),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const p=e=>a({...l,...e}),b=(0,y.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),M=[...o.map(e=>e.allergen),...l.allergens],q=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>p({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>p({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>p({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>p({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>p({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>p({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),M.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:M,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:q?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>p({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>p({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>p({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=M,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:p,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=M(e,l,o,p,m,b),T=e=>a.holds[e]??0,$=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l}))},N.items),D=(e,l)=>Math.min(10,...e.map(e=>{const s=($[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),A=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},I=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,O=(0,y.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,I?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>p||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>A(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),D(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>A(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',D([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&O.tables.length?(0,v.jsx)(q,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),y=_r(d[10]),p=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function M(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,p.useStockItems)(e),h=(0,p.useShellStore)((0,r.useShallow)(l=>(0,p.venueCounts)(l,e))),u=(0,p.useShellStore)(l=>!!l.server[e]),y=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(y[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:y,known:m}}function q({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,y.usePlan)(e),p=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(p[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),M=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},q=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),p.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{style:{borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>M(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:q.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>M(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},827,[808,809,30,127,873,929,928,1299,813,819,825,1026,814,816,806,828,821,24]);
+__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),e.stockNeed=s,e.reservedOn=a,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,a]of Object.entries(s({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+a;return o},e.heldSummary=function(t,r,o){const i={},s={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])t.served||('item'===t.kind?i[t.id]=(i[t.id]??0)+t.qty:s[t.id]=(s[t.id]??0)+t.qty);return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:s,stock:a(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>`${'item'===t.kind?c(r.find(r=>r.id===t.id)?.name??'Reserved item'):n.find(r=>r.key===t.id)?.name??t.id} x${t.qty}${t.served?' (served)':''}`).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return y}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&O(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&h(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return A}}),e.shownStatus=S,e.coversToday=function(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=o.filter(A),s=o.filter(t=>!A(t)&&['confirmed','pending','seated'].includes(S(t))),a=t=>t.reduce((t,r)=>t+r.partySize,0);return{done:a(i),toCome:a(s),total:a(i)+a(s)}};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active);function s(t,r,n=!1){const o={};for(const i of t.holds??[])if(!i.served||n)if('stock'===i.kind)o[i.id]=(o[i.id]??0)+i.qty;else for(const t of r.find(t=>t.id===i.id)?.uses??[])o[t.key]=(o[t.key]??0)+t.qty*i.qty;return o}function a(t,r,o,i){const a={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(s(c,o)))a[t]=(a[t]??0)+r;return a}const c=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),l=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,d=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),u=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),b=t=>t.dogs??(t.dog?1:0),y=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const p=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),h=t=>t.tables.some(t=>t.accessible),O=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+b(r),0);const k=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),A=t=>'finished'===t.status;function S(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'})){const l=n[e.id],c=u.find(l=>l.allergen===e.id),f='contains'===l?t.colours.redBg:'may'===l?t.colours.amberBg:t.colours.surface2,h='contains'===l?'#FFD9D4':'may'===l?'#FFE2A8':t.colours.muted;return(0,d.jsxs)(s.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:c?2:1,borderColor:c?t.colours.red:t.colours.border},children:[(0,d.jsx)(o.T,{size:14,weight:"medium",colour:l?h:t.colours.text,children:e.label}),(0,d.jsxs)(o.T,{size:13,colour:h,children:['contains'===l?'Contains':'may'===l?'May contain':'Not listed',c?` \xb7 YOUR ALLERGY (${(0,a.severityLabel)(c.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,d.jsxs)(o.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,d.jsx)(s.default,{testID:"allergen-signoff",children:(0,d.jsx)(o.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${c(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,d.jsx)(o.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:e,declared:l}){const n=Object.entries(e);return n.length?(0,d.jsx)(o.Row,{wrap:!0,gap:5,children:n.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,n])=>{const s=l.some(l=>l.allergen===e);return(0,d.jsx)(o.Badge,{label:`${s?'\u26a0 ':''}${(0,a.allergenLabel)(e)}${'may'===n?' (may)':''}`,kind:s?'contains'===n?'red':'amber':'neutral'},e)})}):(0,d.jsx)(o.Muted,{children:"No listed allergens"})},r(_d[0]);var e,l=r(_d[1]),n=r(_d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(_d[3]),t=r(_d[4]),o=r(_d[5]),d=r(_d[6]);const c=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},829,[30,1032,127,814,821,813,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},830,[804,30,263,819,821,813,24]);
+__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},831,[]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},832,[30,263,821,813,24]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},833,[5]);
+__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:j,amount:p,restaurantId:b,allowGiftCard:x=!0,onPaid:f,title:g="Pay"}){const y=(0,o.useGiftCards)(b).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,M]=(0,s.useState)(!1),_=y.find(e=>e.code===m),v=_?Math.min(_.balance,p):0,R=p-v;return(0,h.jsxs)(u.Sheet,{visible:e,onClose:j,title:g,children:[(0,h.jsx)(u.DemoPaymentNotice,{}),x&&y.length>0?(0,h.jsxs)(l.default,{style:{gap:6},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"Use a gift card"}),(0,h.jsxs)(u.Row,{wrap:!0,children:[(0,h.jsx)(u.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),y.map(e=>(0,h.jsx)(u.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,h.jsx)(u.T,{weight:"semibold",children:"Payment method"}),(0,h.jsx)(u.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,h.jsx)(u.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,h.jsxs)(l.default,{style:{gap:2},children:[(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Amount"}),(0,h.jsx)(u.T,{children:(0,n.gbp)(p)})]}),v?(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Gift card"}),(0,h.jsxs)(u.T,{colour:c.colours.ok,children:["\u2212",(0,n.gbp)(v)]})]}):null,(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"To pay now"}),(0,h.jsx)(u.T,{weight:"bold",size:20,colour:c.colours.gold,children:(0,n.gbp)(R)})]})]}),T?(0,h.jsx)(t.default,{color:c.colours.gold}):(0,h.jsx)(u.Button,{label:`Pay ${(0,n.gbp)(R)} \u2014 demo`,onPress:()=>{M(!0),setTimeout(()=>{M(!1),f({giftCardCode:m,giftApplied:v,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=r(d[3]),n=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},834,[30,246,127,819,816,821,813,24]);
+__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},835,[30,127,813,816,1014,1015,1016,821,24]);
+__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},836,[952,863,1096,820,2,1014]);
+__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoutersCustomerHome=function(){const[e,n]=(0,t.useState)(!1),[p,m]=(0,t.useState)(!1),[b,y]=(0,t.useState)('All'),S=(0,h.useMenu)('souters'),M=(0,t.useMemo)(()=>['All',...Array.from(new Set(S.map(e=>e.section)))],[S]),k=S.filter(e=>'All'===b||e.section===b);if(e)return(0,j.jsx)(u.Screen,{title:"Souter's Inn",back:!1,children:(0,j.jsx)(c.VenueRequestForm,{rid:"souters",kind:"table",onClose:()=>n(!1)})});if(p)return(0,j.jsxs)(u.Screen,{title:"Menu",subtitle:"Souter's Inn",back:!1,children:[(0,j.jsx)(u.Button,{kind:"ghost",label:"\u2039 Back",onPress:()=>m(!1)}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes. Please speak to staff about allergens \u2014 nothing is signed off for ordering yet."]}),(0,j.jsx)(u.Row,{wrap:!0,gap:6,children:M.slice(0,12).map(e=>(0,j.jsx)(u.Chip,{label:e,selected:b===e,onPress:()=>y(e)},e))}),k.map(e=>(0,j.jsx)(o.default,{testID:`souters-dish-${e.id}`,children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,j.jsx)(u.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,j.jsx)(u.T,{children:null==e.price?e.priceNote||'Ask staff':(0,f.gbp)(e.price)})]}),e.description?(0,j.jsx)(u.Muted,{children:e.description}):null,(0,j.jsx)(u.Muted,{children:"Awaiting allergen sign-off \xb7 not orderable yet"})]})},e.id))]});return(0,j.jsxs)(u.Screen,{title:"Souter's Inn",subtitle:"Kirkoswald \xb7 Southern Ayr",children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:160}),(0,j.jsx)(s.FindPub,{rid:"souters"}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-book-table",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Book a table"}),(0,j.jsx)(u.Muted,{children:"Send a request to the venue. No deposit and no payment here \u2014 staff will confirm."}),(0,j.jsx)(u.Button,{label:"Book a table",onPress:()=>n(!0)})]})}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-menu-card",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Menu"}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes from the venue menus. Allergen information is not signed off yet \u2014 please speak to staff about allergens. Ordering stays off until the Head Chef signs each dish off."]}),(0,j.jsx)(u.Button,{kind:"secondary",label:"Browse the menu",onPress:()=>m(!0)})]})}),(0,j.jsx)(u.Muted,{children:"Table deposits are not set. Closing time (9pm or 10pm) to confirm. No payment is taken here."})]})},_e.SoutersStaffHome=function({app:e}){return(0,j.jsxs)(o.default,{testID:"souters-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:180}),(0,j.jsx)(u.T,{size:24,weight:"bold",center:!0,children:e}),(0,j.jsxs)(u.Card,{children:[(0,j.jsx)(u.T,{weight:"bold",children:"Ready for venue setup"}),(0,j.jsx)(u.Muted,{children:"Contact: souters@southernayr.com \xb7 01655 760653. No named manager or staff list yet \u2014 no personal links have been created."})]}),(0,j.jsx)(u.Muted,{center:!0,children:"Areas are set (Restaurant, Bar, Mezzanine, Beer garden, Ice cream & cake corner). Table plan to confirm \u2014 no sample tables. Menu seeded without allergen sign-off."}),(0,j.jsx)(u.Muted,{center:!0,children:"Guests request a table in the Customer app. Proposed closing time to confirm."})]})};var e,s=r(d[0]),t=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),f=r(d[7]),x=r(d[8]),j=r(d[9])},854,[862,30,127,861,813,864,819,816,1135,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return u}}),_e.LauncherLine=function(){return(0,c.jsx)(l.default,{style:{borderTopWidth:1,borderColor:n.colours.border,paddingTop:10,marginTop:4},children:(0,c.jsx)(s.Muted,{center:!0,children:u})})},_e.HubTile=function({icon:e,label:u,sub:h,onPress:p,badge:f}){return(0,c.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:u,onPress:p,style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,maxWidth:'31.5%',minWidth:96,backgroundColor:e?'#1d1a14':n.colours.surface,borderRadius:14,borderWidth:1,borderColor:n.colours.border,padding:10,gap:2,alignItems:'center'}),children:[b.includes(e)?(0,c.jsx)(t.Icon,{name:e,size:24,colour:n.colours.gold}):(0,c.jsx)(s.T,{size:22,children:e}),(0,c.jsx)(s.T,{size:13,weight:"semibold",center:!0,children:u}),h?(0,c.jsx)(s.T,{size:11,colour:n.colours.muted,center:!0,children:h}):null,f?(0,c.jsx)(l.default,{style:{position:'absolute',top:6,right:6,backgroundColor:n.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,c.jsx)(s.T,{size:10,weight:"bold",colour:n.colours.onGold,children:f})}):null]})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),s=r(d[3]),n=r(d[4]),t=r(d[5]),c=r(d[6]);const u='Card payments: not set up yet';const b=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},855,[30,263,127,813,821,1006,24]);
+__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return T}}),_e.openShiftOf=$,_e.loggedBreakMins=D,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return K}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return G}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},u=_r(_d[8]),f=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=e=>e.out?e.signOff?'confirmed':'awaiting':'open',g=e=>!!e.out&&!!e.signOff,h={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},y=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return b(new Date(n,a-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),E=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),S=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],v=1271,R=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,T=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function $(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function D(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const P=e=>!!e?.breaks?.some(e=>!e.end),A=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,M=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function j(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...N.includes(e.id)?{displayClock:!0}:{}}))}const N=['st-jack'];function C(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const U=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:T.map(e=>({...e})),workEmail:'',staff:j(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:C(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},V=(0,u.create)()((0,f.persist)((e,n)=>({...U(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:n,job:a,active:!0,level:x[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:A('ph'),caption:t,tone:M[e.photos.length%M.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:k(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:k(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=y(t,e),o=y(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:k(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=y(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,n)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??D({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=$(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:D({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const u=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),u.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),u.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),u.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),u.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},u.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),h.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...u.reverse().map(e=>({id:A('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>h.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};h.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(U()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Map(e.staff.map(e=>[e.id,e]));return{staff:[...j().map(e=>({...e,active:n.get(e.id)?.active??!0})),...e.staff.filter(e=>!l.ROSTER.some(t=>t.id===e.id)&&!B.includes(e.id))],hourly:{...e.hourly,...C()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,f.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>_.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=U();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=I(b(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:y(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),q=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,B=['st-2','st-3','st-4','st-5'],x={owner:'Owner',manager:'Manager',staff:'Staff'},K={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const W=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),F=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=W(e);return a.includes(n)||a.includes(n.split(' ')[0])},G=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},856,[5,6,1204,1129,833,1024,1132,1116,952,1117,14,1033]);
+__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},857,[1024,833,1132,5,1116,952,1117,858,872,1119]);
+__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},858,[]);
+__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return w}}),_e.sha256Hex=h,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await h(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return m}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(m);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(m,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return v}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]);const s=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>n.default),version:1})),f=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,w={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function h(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const m=(0,a.venueKey)('covercharge-device-id');const p=(()=>{try{if('undefined'==typeof window||!window.location)return null;const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),y=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),S=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),v=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},859,[1116,952,1117,5,806,14,1150]);
+__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},860,[30,127,869,813,819,859,1014,836,821,24]);
+__d(function(g,_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,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=L,_e.PoweredBy=O,_e.RestaurantLogo=S,_e.RestaurantHero=function({rid:e,size:o=200,showPlace:r=!0}){const c=L(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),b='yasmins'===c.rid?c.logo:u?w[c.rid]:c.custom?c.logo:w[c.rid]??c.logo;return(0,j.jsxs)(l.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[b?(0,j.jsx)(s.default,{source:b,accessibilityLabel:`${c.name} logo`,style:{width:o,height:o,borderRadius:!u&&c.custom?o/2:0},resizeMode:"contain"}):(0,j.jsx)(S,{rid:c.rid,size:o}),u?null:(0,j.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),r&&c.place?(0,j.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.RestaurantBrand=function({rid:e,sub:t,size:o=T,nameSuffix:r}){const s=L(e);return(0,j.jsxs)(l.default,{style:{gap:2,flexShrink:1},children:[(0,j.jsx)(O,{}),(0,j.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,j.jsx)(S,{rid:s.rid,size:o}),(0,j.jsxs)(l.default,{style:{flexShrink:1},children:[(0,j.jsxs)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.semibold,fontSize:17,lineHeight:22,color:f.colours.text},(0,h.webLine)({lineHeight:22},17)],children:[s.name,r??'']}),t?(0,j.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:s.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})]})};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),l=e(_r(d[5])),c=_r(d[6]),u=_r(d[7]),f=_r(d[8]),h=_r(d[9]),b=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]);const p={"3idiots":_r(d[14]),cecchinis:_r(d[15]),mrbasrais:_r(d[16]),yasmins:_r(d[17]),williewastles:_r(d[18]),rupeeroom:_r(d[19]),smokinggoat:_r(d[20]),pizzaioli:_r(d[21]),drunkencoo:_r(d[22]),abbotsford:_r(d[23]),kirkton:_r(d[24]),greenside:_r(d[25]),wildings:_r(d[26]),kirkmichael:_r(d[27]),souters:_r(d[28]),anchorage:_r(d[29]),saltmarsh:_r(d[30]),brae:_r(d[31])},w={"3idiots":_r(d[32]),cecchinis:_r(d[33]),mrbasrais:_r(d[34]),yasmins:_r(d[35]),williewastles:_r(d[36]),rupeeroom:_r(d[37]),smokinggoat:_r(d[38]),pizzaioli:_r(d[39]),drunkencoo:_r(d[40]),abbotsford:_r(d[41]),kirkton:_r(d[42]),greenside:_r(d[43]),wildings:_r(d[44]),kirkmichael:_r(d[45]),souters:_r(d[28]),anchorage:_r(d[46])};x.PITCH&&(delete p.anchorage,delete w.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,o.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),r='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??r??n??b.VENUE_RID}function L(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),o=(0,u.useOwner)(e=>e.branding[t]),s=o?.logoUri?{uri:o.logoUri}:p[t],l=o?.accent??f.colours.gold,h=r.default.useMemo(()=>(0,y.checkAccent)(l,f.colours.bg,f.colours.onGold,f.colours.text),[l]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:s,accent:l,accentText:h.accentText,onAccent:h.onAccent,custom:!!o?.logoUri}}function O({size:e=10}){return(0,j.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function S({rid:e,size:t=T}){const o=L(e);if(o.logo)return(0,j.jsx)(s.default,{source:o.logo,accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:o.custom?t/2:0},resizeMode:"contain"});const r=o.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,j.jsx)(l.default,{accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:o.accentText,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:o.accentText,fontSize:.36*t},children:r})})}},861,[6,877,804,30,196,127,819,856,821,1238,5,2,1237,24,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273]);
+__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FindPub=function({rid:e}){const p=(0,l.pubLocation)(e),[b,y]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[j,w]=(0,n.useState)(null),[I,v]=(0,n.useState)(null);if(!p)return null;const D=async()=>{y(!1),x(!0),v(null);const e=await(0,u.getFix)();x(!1),'object'==typeof e?(w(Math.round((0,c.distanceM)(p,e))),v(null)):(w(null),v('Your location was not shared. You can still use the address and open directions.'))};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(t.default,{testID:"find-pub",style:{gap:10},children:[(0,h.jsx)(o.T,{accessibilityRole:"header",weight:"bold",children:"Find us"}),(0,h.jsx)(o.T,{children:p.address}),(0,h.jsx)(o.Muted,{children:"See your approximate distance, or open directions. Location is optional and is never saved."}),(0,h.jsx)(o.Button,{testID:"find-pub-distance",label:f?'Finding your distance\u2026':'Find us \u2014 show my distance',accessibilityLabel:`Find ${p.name}, show my distance using my location once`,disabled:f,onPress:()=>y(!0)}),(0,h.jsxs)(t.default,{accessibilityLiveRegion:"polite",testID:"find-pub-result",children:[null!=j?(0,h.jsxs)(o.T,{children:["About ",j<1e3?`${j} m`:`${(j/1e3).toFixed(1)} km`," away, in a straight line."]}):null,I?(0,h.jsx)(o.T,{children:I}):null]}),(0,h.jsx)(o.Button,{testID:"find-pub-directions",kind:"secondary",label:"Open directions in Maps",accessibilityLabel:`Open directions to ${p.name}, ${p.address}, without sharing my location with CoverCharge`,onPress:()=>{s.default.openURL(`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(p.address)}`)}}),(0,h.jsx)(o.Sheet,{visible:b,onClose:()=>y(!1),title:"Use your location for distance?",testID:"find-pub-reason",children:(0,h.jsxs)(t.default,{style:{gap:12},children:[(0,h.jsxs)(o.T,{children:["We use your phone\u2019s location once to estimate how far you are from ",p.name,". Your position stays on this screen only: it is not stored or sent to the pub."]}),(0,h.jsx)(o.T,{children:"You can refuse location and still see the address and use directions."}),(0,h.jsx)(o.Button,{testID:"find-pub-allow",label:"Use my location once",onPress:()=>{D()}}),(0,h.jsx)(o.Button,{testID:"find-pub-cancel",kind:"secondary",label:"Not now \u2014 keep the address",onPress:()=>y(!1)})]})})]})})};var n=r(d[0]),s=e(r(d[1])),t=e(r(d[2])),o=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},862,[30,239,127,813,988,954,1274,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getSupabase=function(){if(_)return _;if(!(0,u.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return _=(0,s.createClient)(u.SUPABASE_URL,u.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,o.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}}}),_},_e.setSupabaseClient=function(e){_=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),u=r(d[2]),o=r(d[3]);let _=null},863,[1116,1154,1096,1196]);
+__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestForm=function({rid:e,kind:l,hotel:c,allDayHours:j,sessionHours:q,onClose:T}){const[D,f]=(0,o.useState)({name:'',phone:'',email:'',notes:'',date:(0,p.localDate)(),service:(0,t.isQueuedVenue)(e)||'greenside'===e?void 0:'Lunch',time:j||'greenside'===e?'10:00':'12:00',covers:2,checkIn:(0,p.localDate)(),checkOut:'',roomType:c?.roomTypes[0]?.id,guests:2,addDinner:!1}),v=e=>f(t=>({...t,...e})),[C,I]=(0,o.useState)(''),[S,w]=(0,o.useState)(''),[B,P]=(0,o.useState)(null),[R,Y]=(0,o.useState)(''),[M,N]=(0,o.useState)(!1),[$,V]=(0,o.useState)(!1),z=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let s=!0;return(0,b.requestChallenge)(e,l).then(e=>{s&&P(e)}).catch(n=>{s&&Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(n).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(n))}),()=>{s=!1}},[e,l]);const L=async()=>{if(z.current)return;const o=(0,t.isQueuedVenue)(e)?(0,s.queuedRequestError)(e,D,q):j&&'table'===l?(0,r.allDayRequestError)(D,j):(0,n.errorForVenue)(e,l,D,c);if(o)Y(o);else if(B&&C.trim()){z.current=!0,V(!0),Y('');try{await(0,b.sendVenueRequest)(e,l,D,B.id,C,S),N(!0)}catch(s){Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(s).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(s))}finally{z.current=!1,V(!1)}}else Y('Complete the security check.')},F={minHeight:48,fontSize:18,color:y.colours.text};return(0,x.jsxs)(u.default,{testID:`venue-${l}-form`,style:{gap:16,alignItems:'stretch'},children:[(0,x.jsx)(h.H2,{children:'table'===l?'Book a table':'Book a room'}),(0,x.jsx)(h.T,{size:18,center:!0,children:'greenside'===e?'No payment is taken for this request. Deposit terms to confirm. This is a request, not an instant confirmation.':'No deposit. No payment. This is a request, not an instant confirmation.'}),M?(0,x.jsx)(h.Banner,{kind:"info",title:'greenside'===e?'Request sent. A Greenside manager must confirm your table.':c?.enabled?'Request sent. The hotel will contact you to confirm.':'Request sent. The venue will contact you to confirm.',children:"Nothing has been charged. No email or text is sent by this app."}):(0,x.jsxs)(x.Fragment,{children:['table'===l?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(k,{label:"Date (YYYY-MM-DD)",testID:"request-date",value:D.date,onChangeText:e=>v({date:e}),placeholder:"2026-11-20",style:F}),(0,t.isQueuedVenue)(e)||'greenside'===e||j?null:(0,x.jsx)(h.Row,{wrap:!0,children:['Lunch','Dinner'].map(e=>(0,x.jsx)(h.Button,{testID:`request-service-${e.toLowerCase()}`,label:e+(D.service===e?' \xb7 selected':''),kind:D.service===e?'primary':'secondary',onPress:()=>v({service:e,time:'Lunch'===e?'12:00':'18:00'}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Time within kitchen hours"}),(0,x.jsx)(h.Row,{wrap:!0,children:((0,t.isQueuedVenue)(e)?(0,s.queuedRequestSlots)(e,D.date||'',q):j?(0,r.allDaySlots)(D.date||'',j):(0,n.slotsForVenue)(e,D.date||'',D.service||'Lunch')).map(e=>(0,x.jsx)(h.Button,{testID:`request-time-${e.replace(':','')}`,label:e+(D.time===e?' \xb7 selected':''),kind:D.time===e?'primary':'secondary',onPress:()=>v({time:e}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(k,{label:"Covers",testID:"request-covers",keyboardType:"number-pad",value:String(D.covers??''),onChangeText:e=>v({covers:Number(e)}),style:F})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(h.T,{size:18,center:!0,children:[null==c?.bedrooms?'':`${c.bedrooms} bedrooms. `,c?.priceNote,"."]}),(0,x.jsx)(k,{label:"Check-in date (YYYY-MM-DD)",testID:"request-check-in",value:D.checkIn,onChangeText:e=>v({checkIn:e}),style:F}),(0,x.jsx)(k,{label:"Check-out date (YYYY-MM-DD)",testID:"request-check-out",value:D.checkOut,onChangeText:e=>v({checkOut:e}),style:F}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Room type"}),c?.roomTypes.map(e=>(0,x.jsx)(h.Button,{testID:`request-room-${e.id}`,label:`${e.name} \xb7 ${null==e.pricePence?'Price to confirm with the hotel':`${e.from?'from ':''}\xa3${e.pricePence/100}`} \xb7 ${c.breakfast}${D.roomType===e.id?' \xb7 selected':''}`,kind:D.roomType===e.id?'primary':'secondary',onPress:()=>v({roomType:e.id})},e.id)),(0,x.jsx)(k,{label:"Guests",testID:"request-guests",keyboardType:"number-pad",value:String(D.guests??''),onChangeText:e=>v({guests:Number(e)}),style:F}),(0,x.jsx)(h.Button,{testID:"request-add-dinner",label:"Add dinner \xb7 "+(D.addDinner?'Yes':'No'),kind:D.addDinner?'primary':'secondary',onPress:()=>v({addDinner:!D.addDinner})}),(0,x.jsx)(h.T,{size:18,center:!0,children:"The hotel will arrange dinner details with you."})]}),(0,x.jsx)(k,{label:"Name",testID:"request-name",autoComplete:"name",value:D.name,onChangeText:e=>v({name:e}),style:F}),(0,x.jsx)(k,{label:"Phone",testID:"request-phone",keyboardType:"phone-pad",autoComplete:"tel",value:D.phone,onChangeText:e=>v({phone:e}),style:F}),(0,x.jsx)(k,{label:"Email",testID:"request-email",keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",value:D.email,onChangeText:e=>v({email:e}),style:F}),(0,x.jsx)(k,{label:'table'===l?'Notes (allergies, occasion)':'Notes',testID:"request-notes",multiline:!0,maxLength:2e3,value:D.notes,onChangeText:e=>v({notes:e}),style:F}),(0,x.jsx)(u.default,{style:{display:'none'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,x.jsx)(k,{label:"Leave this empty",value:S,onChangeText:w})}),B?(0,x.jsx)(k,{label:`Security check: ${B.question} = ?`,testID:"request-answer",keyboardType:"number-pad",value:C,onChangeText:I,style:F}):(0,x.jsx)(h.T,{size:18,center:!0,children:"Preparing security check\u2026"}),R?(0,x.jsx)(h.Banner,{kind:"warn",title:"Please check your request",children:R}):null,(0,x.jsx)(h.Button,{testID:"request-submit",label:$?'Sending request\u2026':'Send request',disabled:$||!B,onPress:()=>{L()}})]}),(0,x.jsx)(h.Button,{kind:"secondary",label:M?'greenside'===e?'Back to the restaurant':c?.enabled?'Back to the hotel':'Back to Customer home':'Back to Customer home',onPress:T})]})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),u=(e=l)&&e.__esModule?e:{default:e},c=_r(d[6]),h=_r(d[7]),y=_r(d[8]),p=_r(d[9]),b=_r(d[10]),x=_r(d[11]);function k({label:e,...t}){return(0,x.jsxs)(u.default,{style:{gap:6,alignSelf:'stretch',width:'100%'},children:[(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:e}),(0,x.jsx)(c.TextInput,{accessibilityLabel:e,placeholderTextColor:y.colours.muted,...t,style:[{minHeight:48,fontSize:18,color:y.colours.text,backgroundColor:y.colours.surface2,borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:12},t.multiline?{minHeight:96,textAlignVertical:'top'}:null,t.style]})]})}},864,[6,941,1392,1393,30,127,877,813,821,11,1020,24]);
+__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return u}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},u=l(n.name,80);if(!u)return null;const b={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;b[a]=s&&n?[s,n]:null}const y=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:l(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:l(o.submittedAt,10),onboardedAt:l(o.onboardedAt,10),venue:{name:u,tagline:l(n.tagline,120),address:l(n.address,200),phone:l(n.phone,30),email:l(n.email,120),website:l(n.website,120),hasLogo:!!n.hasLogo},hours:{days:b,note:l(o.hours?.note,300)},tables:{template:y,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>l(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:l(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:l(a?.job,60),email:l(a?.email,120),phone:l(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:l(a?.name,80)??'',category:l(a?.category,40),phone:l(a?.phone,30),email:l(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:l(a?.provider,40)??'',handle:l(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:l(o.notes,1e3)}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features}}},e.hoursLines=function(a){return u.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return b}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],u=[1,2,3,4,5,6,0],l=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const b={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},865,[1110]);
+__d(function(e,a,i,n,r,o,s){r.exports={version:1,venueId:"kirkmichael",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"The Kirkmichael Arms",tagline:"Michelin-listed restaurant and bar in Kirkmichael, Ayrshire",address:"3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH",phone:"01655 750 200",email:"enquiries@thekirkmichaelarms.co.uk",website:"https://www.kirkmichaelarms.co.uk/",hasLogo:!0},hours:{days:{0:["13:00","22:30"],1:null,2:null,3:null,4:["13:00","22:30"],5:["13:00","22:30"],6:["13:00","22:30"]},note:"Thu\u2013Sun from 1pm; schema close 22:30. Michelin lists Sunday from 12:30 \u2014 confirm. Closed Mon\u2013Wed."},tables:{template:"restaurant",tables:null,covers:56,areas:["Restaurant","Bar","Private dining (The Room)"],needsConfirmation:!0,note:"56 covers from historical sale listing; private dining about 18. Table count unknown \u2014 ask Gordon/Justin."},team:[{name:"Justin Galea",role:"owner",job:"Chef & Owner",email:"enquiries@thekirkmichaelarms.co.uk",phone:"01655 750 200"}],suppliers:[],accounts:[{provider:"instagram",handle:"@kirkmichaelarms_unfiltered"},{provider:"facebook",handle:"kirkmichaelarms"},{provider:"gmail",handle:"enquiries@thekirkmichaelarms.co.uk"},{provider:"tripadvisor",handle:"The Kirkmichael Arms"},{provider:"google-business",handle:"The Kirkmichael Arms"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Seed as venue_id kirkmichael (separate tenant). Chef-owner Justin Galea. Brand accent #B87754 (whisky amber); lion emblem + wordmark in branding/. Deposit amount unknown \u2014 leave off until Gordon confirms. Bookings currently via own site /booking (own website booking page noted in research only). Menu from live Sample menus 2026-11-05; specials board changes often. Never blend with other venues' data."}},866,[]);
+__d(function(e,n,a,o,s,t,i){s.exports={version:1,venueId:"wildings",source:"from-config",submittedAt:"2026-11-05",venue:{name:"Wildings Hotel & Restaurant",tagline:"Coastal cuisine with character",address:"Maidens Road, Maidens, KA26 9NR",phone:"01655 331 401",email:"bookings@wildingsrestaurant-hotel.co.uk",website:"https://www.wildingshotel.com/",hasLogo:!0},hours:{days:{0:["12:00","21:00"],1:["12:00","21:00"],2:["12:00","21:00"],3:["12:00","21:00"],4:["12:00","21:00"],5:["12:00","21:00"],6:["12:00","21:00"]},note:"Lunch Mon\u2013Sat 12:00\u201314:00, Sun 12:00\u201314:30; dinner daily 18:00\u201321:00 (closed 14:00\u201318:00). Bar hours not published. Sunday lunch end time to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:["Dining room 1","Dining room 2"],needsConfirmation:!0,note:"Two dining rooms per website; names, tables and covers unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"profile.php?id=100057663900963"},{provider:"instagram",handle:"@wildingsmaidens"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate tenant, venue id wildings. Accent #FFE3A5 (logo star gold) on ink #272A2F. No demo/local roster. Authorised real team is loaded from this venue\u2019s server; remaining staff list and personal manager contacts are to confirm. Deposit off until confirmed. Bookings are by phone/email today; site is Duda, so no Wix sync. Pay settings are app defaults, to confirm. Never blend with other venues' data.",onboardedAt:"2026-11-05"}},867,[]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},868,[5,1237]);
+__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},869,[30,127,1358,821,24]);
+__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(i,u,l,h,f,y){const v=(0,s.examplesAllowed)(),k=(0,a.clampWeeks)(i.settings.forecastMinWeeks),M=v?null:y??(0,a.buildHistory)(i.id,u,l,[],f,k),w=v||!!M?.enough,b=(0,o.hoursFor)(i,f),H=[],O=(0,r.ymd)(f);let S=1;for(const e of h.filter(e=>e.date===O&&(null===e.restaurantId||e.restaurantId===i.id)))H.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(S*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!b)return{open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:H,suggestions:['Kitchen closed today (per listed hours).'],multiplier:S,example:v,enough:w,minWeeks:k};const I=v?t.EXAMPLE_HISTORY[i.id]??t.EXAMPLE_HISTORY.default:w&&M?M:{covers:{},takeaway:{}},x=f.getDay(),E=c(i,f),C=(0,e.lastFoodOn)(i,O);let N=b.close.getMinutes()>0?b.close.getHours():b.close.getHours()-1;if(C){const[e,t]=C.time.split(':').map(Number);N=Math.min(N,t>0?e:e-1),'kitchen closes'!==C.reason&&H.push(`Last food orders ${C.time} (${C.reason})`)}const $=u.filter(e=>e.restaurantId===i.id&&e.date===O&&['confirmed','seated','finished'].includes(e.status)),_=$.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),P=Math.min(E[0],b.open.getHours(),..._),T=Math.max(E[1],N,..._),A=[];for(let e=P;e<=T;e++){const t=e>=b.open.getHours()&&e<=N,o=I.covers[x]?.[e]??0,s=I.takeaway[x]?.[e]??0,a=$.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=$.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),u=t?Math.round(o*i.settings.walkInShare*S):0,c=w&&t?Math.max(0,Math.round(o*S*(1-i.settings.walkInShare))-a):0,h=Math.max(n,u)+c,f=a+h,p=l.filter(t=>t.restaurantId===i.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,r.ymd)(new Date(t.slotTime))===O).length,y=t?Math.max(p,Math.round(s*S)):p;A.push({hour:e,booked:a,walkIns:h,covers:f,coversLow:w?Math.round(.8*f):f,coversHigh:w?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const L=p(i,x);if(w&&L){const e=L-A.reduce((e,t)=>e+t.covers,0),t=A.filter(e=>e.hour>=b.open.getHours()&&e.hour<=N);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=n(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=A.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const R=f.getHours()+(f.getMinutes()>=30?1:0),D=A.filter(e=>e.hour>=R),j=D[0],W=e=>D.reduce((t,o)=>t+e(o),0),F={covers:W(e=>e.covers),low:W(e=>e.coversLow),high:W(e=>e.coversHigh),takeaway:W(e=>e.takeaway),booked:W(e=>e.booked)},G=[],z=i.settings.capacityPerHour,B=D.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);B&&B.covers>=.85*z&&G.push(`Dining room near capacity around ${String(B.hour).padStart(2,'0')}:00 (about ${B.covers} of ${z} covers) \u2014 consider pausing or capping takeaway slots then.`);const V=D.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);V&&G.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][x]} from ${String(V.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);F.takeaway>=10&&G.push(`About ${F.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);w||G.unshift(`Not enough history yet. ${(0,s.notEnoughTip)(k)}`);G.length||G.push('Looks like a normal service \u2014 no action suggested.');return{open:!0,nextHour:j,hours:A,restOfDay:F,flags:H,suggestions:G,multiplier:S,example:v,enough:w,minWeeks:k,minCovers:L??void 0}},_e.spread=n,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return u}}),_e.forecastWindow=c,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return p}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'cover':'covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]);function n(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const i={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},u=e=>e.settings.forecastHours??('anchorage'===e.id?i:{});function c(e,t){const r=(0,o.hoursFor)(e,t),s=r.close.getMinutes()>0?r.close.getHours():r.close.getHours()-1,a=u(e)[t.getDay()];if(!a)return[r.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,c]=a[1].split(':').map(Number);return[Math.min(n,r.open.getHours()),Math.max(c>0?i:i-1,s)]}const l={0:50,6:50},h='Gordon, 4 Nov 2026',f=e=>e.settings.minCoversByDay??('anchorage'===e.id?l:{}),p=(e,t)=>{const o=f(e)[t];return o&&o>0?Math.round(o):null}},870,[809,1302,815,818,1119,1303]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},871,[]);
+__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:s,tip:i,giftCardCode:o,notes:l,paidNow:u,phone:g,email:m})=>{const p=t(),b=p.basket,f=b.restaurantId,k=w(b,p.menu,p.customer.allergies),I=k.reduce((e,t)=>e+t.unitPrice*t.qty,0),S='table'===b.mode,h=$(p.orders.filter(e=>e.restaurantId===f).map(e=>e.ref),S?'Q-':'T-',S?p.counters.table:p.counters.order),O=u?n(o,f,I+i):0,C=I+i,v={id:(0,y.uuid)(),ref:`${S?'Q':'T'}-${h}`,restaurantId:f,customerId:p.customer.id,customerName:p.customer.name,type:b.mode,tableNo:b.tableNo,slotTime:s,lines:k,subtotal:I,tip:i,giftCardApplied:O,giftCardCode:O?o:void 0,total:C,paid:u?C:0,status:'new',createdAt:a().toISOString(),allergies:p.customer.allergies,readiness:{},notes:l,channel:'app',...'takeaway'===b.mode?{phone:g??p.customer.phone,email:m??p.customer.email}:{}};e(e=>({orders:[v,...e.orders],basket:{...e.basket,lines:[]},counters:S?{...e.counters,table:h}:{...e.counters,order:h}}));const A=k.filter(e=>e.overridden);return r(f,'order',`Order ${v.ref} placed (${S?`Table ${b.tableNo}`:'takeaway'})${A.length?` \u2014 ALLERGY OVERRIDE on ${A.map(e=>e.name).join(', ')}`:''}`),v.allergies.length&&r(f,'allergy',`Allergies declared and confirmed by customer on ${v.ref}: ${v.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),c(v),v},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},872,[1128,5,1129,833,1132,1116,952,1117,1133,3,945,814,1114,823,940,1033]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},873,[30,1141]);
+__d(function(g,_r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanToken",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isTableNo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fromRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toRow",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return s}}),e.openAt=function(t,r){const n=a(r),o=t.openFrom?a(t.openFrom):null,l=t.lastOrders?a(t.lastOrders):null;return null!==o&&null!==l?o<=l?n>=o&&n=o||n=o:null===l||n{const r=(t??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(r)?r:null},n=t=>/^[0-9]{1,4}$/.test(t),o=r=>r?{on:!!r.is_on,tables:Array.isArray(r.tables)?r.tables.map(String):null,staffAccept:!1!==r.staff_accept,openFrom:r.open_from?String(r.open_from).slice(0,5):null,lastOrders:r.last_orders?String(r.last_orders).slice(0,5):null,guestTip:r.guest_tip??''}:{...t},l=t=>({is_on:t.on,tables:t.tables&&t.tables.length?t.tables.filter(n):null,staff_accept:t.staffAccept,open_from:t.openFrom,last_orders:t.lastOrders,guest_tip:t.guestTip.slice(0,300)}),a=t=>{const[r,n]=t.split(':').map(Number);return 60*r+n},s=t=>`${String(Math.floor(t/60)%24).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;const c=(t,r)=>t.reduce((t,n)=>t+n.qty*(r.find(t=>t.id===n.id)?.pricePence??0),0),u=(t,r,n)=>t.map(t=>r.find(r=>r.id===t.id)).filter(t=>!!t&&(t.allergens.some(t=>n.includes(t))||t.mayContain.some(t=>n.includes(t)))),f=(t,r)=>`${t.replace(/\/$/,'')}/customer-app/index.html?table=${r}`,p=t=>'table'===t.type&&'table-qr'===t.channel,b=t=>p(t)&&!!t.held&&!t.accepted&&'cancelled'!==t.status,m=t=>!b(t),y=t=>'cancelled'===t.status?t.cancelReason?`Cancelled: ${t.cancelReason}`:'Cancelled by the staff.':t.held&&!t.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===t.status||'collected'===t.status||'closed'===t.status?'Served. Enjoy!':'ready'===t.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',O=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],h='Please pay at the bar or till. Paying by card from your phone is coming later.'},876,[]);
+__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.venueTextStyle=d,Object.defineProperty(_e,"Text",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"TextInput",{enumerable:!0,get:function(){return h}});var t=r(_d[0]),n=r(_d[1]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),f=e(r(_d[3])),u=e(r(_d[4])),l=e(r(_d[5])),c=r(_d[6]),s=r(_d[7]);function d(e){if(!t.IS_SOUTERS)return e;const n=l.default.flatten(e)||{};return{...n,...'number'==typeof n.fontSize?{fontSize:(0,c.soutersFont)(n.fontSize)}:{},...'number'==typeof n.lineHeight?{lineHeight:(0,c.soutersFont)(n.lineHeight)}:{},...'string'==typeof n.color?{color:(0,c.soutersInk)(n.color)}:{}}}const y=o.forwardRef(function({style:e,...t},n){return(0,s.jsx)(f.default,{...t,ref:n,style:d(e)})}),p=o.forwardRef(function({style:e,placeholderTextColor:t,...n},o){const f=d([{fontSize:14,color:'#F5F1E8'},e]),y=l.default.flatten(f)||{};return(0,s.jsx)(u.default,{...n,ref:o,placeholderTextColor:'string'==typeof t?(0,c.soutersInk)(t):'#B8B0A0',style:[f,{minHeight:Math.max(44,'number'==typeof y.minHeight?y.minHeight:44),minWidth:Math.max(44,'number'==typeof y.minWidth?y.minWidth:44)}]})}),S=o.forwardRef(function({style:e,...t},o){const u=l.default.flatten(e)||{};return(0,s.jsx)(f.default,{...t,ref:o,style:[u,{color:u.color===n.QUEUED_BRAND?.accent?n.QUEUED_BRAND.smallTextAccent:u.color}]})}),_=t.IS_QUEUED_VENUE?S:t.IS_SOUTERS?y:f.default,h=t.IS_SOUTERS?p:u.default},877,[5,1233,30,206,273,46,868,24]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},914,[30,945,821,813,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},915,[30,127,1297,821,930,813,24]);
+__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:a,who:l,role:s,inStaffApp:o,shiftManager:n,big:d,testID:h}){const[u,b]=(0,t.useState)(!1);return a.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:o,role:s,shiftManager:n})?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Button,{kind:"secondary",small:!d,label:"Edit booking",testID:h??`edit-booking-${a.id}`,accessibilityLabel:`Edit booking, ${a.name}, ${a.time}`,onPress:()=>b(!0),style:{minHeight:d?64:44}}),u?(0,x.jsx)(j,{rid:e,id:a.id,who:l,onClose:()=>b(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:a,who:l,onClose:o,hidePrivate:n}){const[d,r]=(0,t.useState)(null),c=(0,s.useBookings)(e).filter(e=>!e.walkIn&&e.date>=a&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,60);return d?(0,x.jsx)(j,{rid:e,id:d,who:l,hidePrivate:n,onClose:o}):(0,x.jsxs)(p.Sheet,{visible:!0,onClose:o,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: tap the booking you want to change."}),c.length?c.map(e=>(0,x.jsx)(p.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===a?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'cover':'covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===a?'today':e.date}, ${e.time}, ${e.partySize} covers`,onPress:()=>r(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,x.jsx)(p.Muted,{children:"No bookings to edit from today on."}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Close",onPress:o,style:{minHeight:44}})]})},_e.EditBookingSheet=j;var e,t=_r(_d[0]),a=_r(_d[1]),l=(e=a)&&e.__esModule?e:{default:e},s=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),b=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),x=_r(_d[13]);const y=/^([01]\d|2[0-3]):[0-5]\d$/,k=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};function j({rid:e,id:a,who:j,onClose:f,hidePrivate:v='display'===r.APP_VARIANT}){const T=(0,s.useBookings)(e),I=T.find(e=>e.id===a),C=(0,d.useRestaurant)(e),D=(0,o.usePlan)(e),P=(0,n.useBlocks)(e=>e.blocks),[$,w]=(0,t.useState)(I?(0,c.draftOf)(I):null),[B,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(null);if(!I||!$||!C)return null;const z=e=>{S(null),A(null),w({...$,...e})},L=k($.time),_=y.test(L),F=(0,h.tableOptions)(D,T.filter(e=>e.date===$.date),$.table),N=(0,c.changedFields)(I,{...$,time:L}),W=C.settings.turnMins??90,R=async()=>{const t=(0,c.editPatch)(I,{...$,time:L},{by:j||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await s.repo.bookings.update(I.id,t),'seated'===I.status&&'table'in t&&t.table!==I.table){const a=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],l=a(I.table),s=a(t.table),n=o.useFloor.getState(),d=l.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';l.filter(e=>!s.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),s.forEach(t=>n.setLive(e,t,{stage:d,dirty:!1}))}A(`Saved. Changed: ${(0,c.editedWords)(N)}.`),S(null),f()};return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:f,title:`Edit booking \xb7 ${I.name} \xb7 ${I.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,x.jsx)(m.DepositChip,{b:I,money:!0,big:!0,testID:"edit-deposit"}),(0,c.isWixBooking)(I)?(0,x.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:u.colours.gold},children:(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: change what you need, then press Save changes."}),(0,x.jsx)(b.BookingDatePicker,{r:C,today:new Date,value:$.date,onChange:e=>z({date:e})}),(0,x.jsx)(p.Field,{label:"Time (24-hour, for example 19:30)",value:$.time,onChangeText:e=>z({time:e}),testID:"edit-time"}),_?null:(0,x.jsx)(p.T,{size:15,colour:u.colours.amber,children:"Write the time like 19:30."}),(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(p.T,{size:18,children:"Covers"}),(0,x.jsx)(p.Stepper,{value:$.partySize,onChange:e=>z({partySize:e}),min:1,max:60,label:"covers",testID:"edit-covers"})]}),(0,x.jsx)(p.Field,{label:"Name",value:$.name,onChangeText:e=>z({name:e}),testID:"edit-name"}),v?(0,x.jsx)(p.Muted,{children:"Phone and email can be changed in the Managers app; the Display never shows them."}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Field,{label:"Phone",value:$.phone,onChangeText:e=>z({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,x.jsx)(p.Field,{label:"Email",value:$.email,onChangeText:e=>z({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,x.jsx)(p.Field,{label:"Notes",value:$.notes,onChangeText:e=>z({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"}),I.allergies.length||I.allergyNote?(0,x.jsx)(p.Muted,{children:"Allergies are kept separately and are not changed here."}):null,(0,x.jsx)(p.T,{size:18,weight:"semibold",children:(0,h.tableButtonLabel)($.table)}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{kind:$.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+($.table?'':', chosen'),onPress:()=>z({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),F.map(e=>(0,x.jsx)(p.Button,{kind:e===$.table?'primary':'secondary',label:(0,h.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,h.tableButtonLabel)(e)}${e===$.table?', chosen':''}`,onPress:()=>z({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]}),B?(0,x.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg},children:[B.map(e=>(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:e},e)),(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:"You can still save."})]}):null,E?(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:E}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{label:B?'Save anyway':'Save changes',testID:"edit-save",disabled:!_||$.name.trim().length<1||!N.length,onPress:()=>{const t=_?(0,n.blockAt)(P,e,$.date,L):void 0,a=(0,c.editWarnings)(I,{...$,time:L},T,t,W);!a.length||B?R():S(a)},style:{minHeight:56,flex:1}}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Cancel",onPress:f,style:{minHeight:56}})]})]})}},916,[30,127,819,825,824,1021,806,812,1297,821,1298,951,813,24]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},917,[952]);
+__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!s.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);s.useStore.getState().updateMenuItem(e,{soldOut:t})},_e.soldOutNow=function(e,t=c()){return(0,o.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=O,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&O({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),o=_r(d[3]),i=_r(d[4]),s=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=s.useStore.getState().restaurants.find(e=>e.id===t),f=(0,o.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,i.hoursFor)(l,u)?.close??null:null,m=(0,o.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const o=t().entries.find(e=>e.rid===n&&e.itemId===r);o&&o.on&&e(e=>({entries:e.entries.map(e=>e===o?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!!e.auto}:e)}))},expire:(n,r)=>{const a=(0,o.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const i=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&i.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}let p=null;function O(e){if(p)return p;let t=!1;const n=(e=s.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of s.useStore.getState().menu)e[t.restaurantId];for(const t of s.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,o=s.useStore.getState().menu,i=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());i.set(`${t.rid}|${t.itemId}`,n)}const u=o.filter(e=>i.has(`${e.restaurantId}|${e.id}`)&&i.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,i.get(`${e.restaurantId}|${e.id}`)]));s.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},o=s.useStore.subscribe((e,a)=>{if(e.menu===a.menu)return;const o=n(e.menu);if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S))}r=o}),i=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return p=()=>{o(),i(),clearInterval(l),m&&m(),p=null},p}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=s.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],o=(new Date).toISOString(),i=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!i.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...i.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:o,by:'Chef'}))]}))})},918,[1116,952,1117,944,815,872,2,1119,942,30]);
+__d(function(g,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,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return y}}),_e.SliderButton=w,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(f)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]),!n)return null;const s=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(l.default,{...h('dim'),style:{position:s,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(l.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:s,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,b.jsx)(S,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),s=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]);const f='undefined'!=typeof document,p="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",h=e=>f?{dataSet:{ccsl:e}}:{};function x(){(0,t.useEffect)(()=>{if(!f||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=p,document.head.appendChild(e)},[])}const y={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},j=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,k=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function w({a:e,onDone:t,big:o}){const l=e.kind??'primary';return(0,b.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===l?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===l?y.gold:'transparent',borderWidth:'danger'===l?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===l?14:15,weight:'primary'===l?'bold':'medium',colour:'primary'===l?y.ink:'danger'===l?c.colours.red:y.quiet,children:e.label})})}function S({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){x();const u=e.tone??'normal',p=j(u),S=e.content,C=!!e.big,{height:I}=(0,s.default)(),D=e.actions??[];return(0,b.jsxs)(l.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...h('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:C?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:y.bg,borderWidth:1,borderColor:k(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(l.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:p}}):null,(0,b.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:C?18:12,paddingLeft:'normal'!==u?C?24:18:C?20:14,paddingRight:C?20:14,gap:C?10:6},children:[(0,b.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,b.jsx)(a.T,{size:C?34:22,children:e.icon}):null,(0,b.jsxs)(l.default,{style:{flex:1,gap:2},children:[e.kicker?(0,b.jsx)(a.T,{size:C?15:11,weight:"bold",colour:p,style:{letterSpacing:1.4},children:e.kicker}):null,(0,b.jsx)(a.T,{size:C?24:15,weight:"medium",colour:y.text,children:e.title}),e.body?(0,b.jsx)(a.T,{size:C?18:13,colour:y.quiet,children:e.body}):null]}),D.length||S?null:(0,b.jsx)(w,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,D.length?(0,b.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,b.jsx)(w,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,children:[n," more waiting"]}):null]})]})}},919,[30,122,263,151,127,287,821,813,947,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AppBadge=function({label:o}){return(0,c.jsx)(t.default,{testID:"app-badge",accessibilityLabel:`${o} app`,style:{borderWidth:1,borderColor:s.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1,backgroundColor:(0,e.soutersSurface)('#1c1a16')},children:(0,c.jsx)(u.T,{size:10,weight:"bold",colour:s.colours.gold,children:o})})};var e=r(d[0]);r(d[1]);var o,l=r(d[2]),t=(o=l)&&o.__esModule?o:{default:o},s=r(d[3]),u=r(d[4]),c=r(d[5])},920,[868,30,127,821,813,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:v,big:$,sound:p,testID:x="covers-today",day:C,compact:j=!1}){const w=(0,c.useBookings)(e),k=(0,c.useNow)(3e4),T=(0,h.venueYmd)(k),D=C&&C!==T?C:T,I=D!==T,L=I?(0,y.dayCovers)(w,D,T):(0,u.coversToday)(w,T),_=(0,y.dayWord)(D,T),M=/^(Today|Yesterday|Tomorrow)$/.test(_),R=`COVERS ${_.toUpperCase()}`,S=I?`${M?`${_}\u2019s`:_} bookings \u203a`:'Today\u2019s bookings \u203a',O=I?`${M?`${_}, `:''}${(0,y.dayLong)(D)}`:'today',P=(0,o.useLiveState)();if('ready'!==P)return(0,f.jsx)(o.LiveWait,{state:P,title:"Covers today",testID:`${x}-wait`});const W=$?64:44,z=L.total?Math.min(1,L.done/L.total):0,B=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:W,colour:t,testID:`covers-${c}`,sound:p}),(0,f.jsx)(n.T,{size:$||j?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:j?void 0:1,center:j,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:x,accessibilityRole:"button",disabled:!v,onPress:v,accessibilityLabel:`Covers ${O}: ${L.done} done, ${L.toCome} ${D({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:12}),children:[(0,f.jsxs)(s.default,{style:{flexDirection:j?'column':'row',justifyContent:'space-between',alignItems:'center',gap:j?6:void 0},children:[(0,f.jsx)(n.T,{center:j,size:j?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:R}),v?(0,f.jsx)(n.T,{center:j,size:j?14:12,colour:b.colours.muted,children:S}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[B('Done',L.done,b.colours.text,'done'),B(De.set),d=a??t,[n,u]=j[e];return(0,r.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,D.jsxs)(l.default,{testID:"day-bar",style:{gap:8},children:[(0,D.jsx)(s.DaySwitch,{day:d,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day"}),a?(0,D.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null]})},_e.DayView=function({rid:e,day:s,today:r,app:d}){const n=(0,u.useRestaurant)(e),x=(0,u.useBookings)(e),j=(0,u.useEvents)(e),_=(0,p.parseYmd)(s),B=se.date===s),O=(0,f.regularEventsOf)(n).filter(e=>(0,f.occursOn)(e,s)),T=x.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===d;return(0,D.jsxs)(l.default,{testID:"day-view",style:{gap:12},children:[(0,D.jsxs)(c.Card,{children:[(0,D.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,p.niceDate)(_),$?` \xb7 ${$.name} hours`:'']}),(0,D.jsx)(c.Badge,{kind:"gold",label:B?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,D.jsxs)(c.T,{size:E?18:15,children:[C?`Kitchen ${k(C[0])}\u2013${k(C[1])}`:'Kitchen closed',C&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${k(v.time)} (${v.reason})`:'']}),O.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${k(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),w.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,D.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,D.jsx)(a.CoversToday,{rid:e,day:s}),(0,D.jsx)(m.PlattersBooked,{rid:e,date:s,label:B?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,D.jsxs)(l.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,D.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,D.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,D.jsx)(m.BookingNeeds,{b:s}),'display'!==d&&!B&&['confirmed','pending'].includes(s.status)?(0,D.jsx)(l.default,{style:{flexDirection:'row'},children:(0,D.jsx)(A.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,D.jsx)(c.Muted,{children:B?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),l=(e=d)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),f=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),m=_r(_d[14]),A=_r(_d[15]),D=_r(_d[16]);const x=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),j={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},k=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=x(t=>t.day[e]);return s&&s!==t?s:null}},922,[808,936,921,951,30,127,952,813,819,828,815,809,818,821,950,1019,24]);
+__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},923,[122,806]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:c}){const u=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const h=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==c||'seated'!==s.status||!(0,l.hasAllergens)(s)||u.current.has(s.id))continue;const n=h.get(s.id);n&&'seated'!==n&&(u.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[c]),null},e.useKitchenTodoChime=function(t,u,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=u&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,c.soundAllowed)()&&(0,c.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} covers \xb7 ${t.date===u?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5])},924,[808,30,947,819,828,923]);
+__d(function(g,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,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=S,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56}){const t=p(),u=(0,n.useRef)(null),c=(0,n.useRef)(y++).current,{width:l,height:f}=(0,o.default)(),S=()=>u.current?.measureInWindow((e,t,n)=>{n&&w.setState({rect:{x:e,y:t,size:n},owner:c})});return(0,n.useEffect)(()=>{const e=setTimeout(S,50);return()=>clearTimeout(e)},[l,f,t?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===c&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{t?.on||w.getState().owner!==c||w.setState({rect:null,owner:0})},[t?.on]),t?.on?(0,h.jsx)(s.default,{ref:u,testID:"voice-slot",onLayout:S,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),h=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function S(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=S(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1},925,[804,30,287,127,952,806,927,1099,24]);
+__d(function(g,_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,"TABLES",{enumerable:!0,get:function(){return P}}),_e.useTableNames=O,_e.resetTableLive=z,_e.seatBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'seated'),z(e,t.table)},_e.finishBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'finished'),(0,w.tablesOf)(t.table).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=B,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return M}}),_e.TablePicker=N,_e.WalkInSheet=F,_e.AssignTableSheet=A,_e.undoNotice=L,_e.NewBookingSheet=W,_e.useFrontDoor=function(e,t){const[s,o]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[r,d]=(0,a.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>i(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)(F,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:L}):null,l?(0,I.jsx)(W,{wide:t,date:e,onClose:()=>i(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,y.niceDate)((0,y.parseYmd)(e.date))} at ${e.time}`})}):null,r?(0,I.jsx)(A,{booking:r.b,combine:r.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=_r(_d[5]),i=e(a),r=_r(_d[6]),d=e(_r(_d[7])),u=e(_r(_d[8])),c=_r(_d[9]),b=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),k=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),C=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),I=_r(_d[25]);const P=Array.from({length:12},(e,t)=>String(t+1));function O(e){const t=(0,w.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function z(e,t){(0,w.tablesOf)(t).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function B(e,t){const s=(0,h.useBookings)(e),o=(0,h.useOrders)(e),l=O(e),n=(0,w.useFloor)(t=>t.live[e])??{},a=(0,w.usePlan)(e),i=(0,T.useBlocks)(e=>e.blocks),r=(0,y.ymd)(t),d=(0,T.closedAreasAt)(i,e,r,(0,y.hm)(t)),u={};for(const e of l)u[e]=n[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(a.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:n[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,w.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,y.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const M=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function N({use:e,value:t,onPick:o,big:l,best:n,dense:i,bestSet:r,picked:c}){const b=Object.keys(e),[h,p]=(0,a.useState)(0),f=i?6:8,y=i?64:l?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,T=k?Math.floor((h-f*(k-1))/k):y,S=new Set(r??[]),C=n?(0,w.tablesOf)(n)[0]:null;return(0,I.jsx)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:b.map(l=>{const n=e[l],a=t===l||!!c?.includes(l),r=S.has(l),b=C===l&&!a,h=n.busy?['Blocked','Needs clearing','Closed'].includes(n.label)?n.label:'In use':n.soon??'Free';return(0,I.jsxs)(d.default,{accessibilityRole:"button",testID:`pick-table-${l}`,accessibilityLabel:`Table ${(0,s.tableNumbers)(l)}${c?a?', picked':', not picked':''}, ${n.busy?`in use (${n.label})`:n.soon?`free, ${n.soon}`:'free'}${r?', best table':''}${b?', suggested for this party':''}`,accessibilityState:{selected:a,disabled:'Closed'===n.label},disabled:'Closed'===n.label,onPress:()=>o(l),style:{width:T,minHeight:i?58:64,borderRadius:12,borderWidth:a||b?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:a||b?x.colours.gold:n.busy?x.colours.red:x.colours.ok,backgroundColor:a?x.colours.goldTint:n.busy?x.colours.redBg:x.colours.surface2,opacity:'Closed'!==n.label||a?1:.55},children:[(0,I.jsxs)(u.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,I.jsx)(j.T,{weight:"bold",size:22,colour:a?x.colours.goldLight:x.colours.text,children:(0,s.tableNumbers)(l)}),r?(0,I.jsx)(u.default,{testID:"best-table",style:{backgroundColor:x.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,I.jsx)(j.T,{size:11,weight:"bold",colour:x.colours.onGold,children:"BEST"})}):null]}),(0,I.jsx)(j.T,{size:i?13:14,colour:n.busy?'#FFD9D4':n.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},l)})})}const R=[1,2,3,4,5,6,7,8];function F({onClose:e,onSeated:o,wide:l,initialTable:n}){const{rid:p,r:k,now:S}=(0,b.useCtx)(15e3),C=B(p,S),[v,D]=(0,a.useState)(2),[$,P]=(0,a.useState)(!1),[O,M]=(0,a.useState)(n??null),F=(0,w.usePlan)(p),A=(0,h.useBookings)(p),L=(0,T.useBlocks)(e=>e.blocks),W=(0,T.closedAreasAt)(L,p,(0,y.ymd)(S),(0,y.hm)(S)),E=i.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(C).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(F,A.filter(e=>e.date===(0,y.ymd)(S)),e,v,S,(0,f.turnFor)(v,k.settings.turnMins),90,void 0,{closed:W})?.table??null},[F,A,C,v,W.size,S.getTime()]);(0,a.useEffect)(()=>{O&&(0,w.tablesOf)(O).some(e=>'Closed'===C[e]?.label)&&M(null)},[O,W.size]);const[H,_]=(0,a.useState)(!1),[U,q]=(0,a.useState)(''),V=(e,t=String(e),s=()=>{P(!1),D(e)})=>{const o='9+'===t?$:!$&&v===e;return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:l?58:60,height:l?58:56,borderRadius:14,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?x.colours.gold:'transparent'},children:(0,I.jsx)(j.T,{weight:"bold",size:22,colour:o?x.colours.onGold:x.colours.gold,children:t})},t)},G=(0,I.jsxs)(j.Row,{gap:12,style:{justifyContent:'center'},children:[(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One fewer",onPress:()=>D(e=>Math.max(9,e-1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"\u2212"})}),(0,I.jsx)(j.T,{weight:"bold",size:26,children:v}),(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One more",onPress:()=>D(e=>Math.min(40,e+1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"+"})})]}),K=(0,I.jsxs)(u.default,{style:{gap:8,width:l?256:void 0},children:[(0,I.jsx)(j.T,{weight:"semibold",children:"How many people?"}),(0,I.jsxs)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[R.map(e=>V(e)),V(9,'9+',()=>{P(!0),D(e=>e>=9?e:9)})]}),$?G:null]}),[Q,Y]=(0,a.useState)(!1),J=async(t=O)=>{if(!Q){Y(!0);try{const s=await h.repo.bookings.seatWalkIn(p,v,t??void 0,U);z(p,t??void 0),o(s),e()}finally{Y(!1)}}},X=(0,I.jsxs)(u.default,{style:{gap:8,flex:l?1:void 0,minWidth:0},children:[(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(j.T,{weight:"semibold",children:["Table ",(0,I.jsx)(j.T,{colour:x.colours.muted,size:14,children:"(optional)"})]}),O?(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>M(null)}):null]}),(0,I.jsx)(N,{use:C,value:O,onPick:e=>{C[e]&&!C[e].busy?J(e):M(O===e?null:e)},big:l,dense:l,best:E,bestSet:(0,r.bestTables)(F)}),(0,I.jsxs)(j.Muted,{children:["Tap a free table to seat them there",E&&!O?` (suggested for ${v}: ${(0,s.tableNumbers)(E)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,y.hm)(S)}`,maxWidth:l?1100:void 0,testID:"walkin-sheet",children:[(0,I.jsx)(j.Button,{label:`Seat walk-in \xb7 ${v} ${1===v?'person':'people'}${O?` \xb7 ${(0,s.tableNumbers)(O)}`:''}`,disabled:Q,onPress:()=>{J()},testID:"seat-walkin",style:{minHeight:52}}),l?(0,I.jsxs)(j.Row,{gap:16,style:{alignItems:'flex-start'},children:[K,X]}):(0,I.jsxs)(I.Fragment,{children:[K,X]}),(0,I.jsxs)(j.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,I.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:U,onChangeText:q,style:[j.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>_(!0)}),(0,I.jsx)(u.default,{style:{flex:1,minWidth:220},children:(0,I.jsxs)(j.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==c.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function A({booking:e,onClose:t,combine:o}){const{rid:l,r:n,now:d}=(0,b.useCtx)(15e3),c=B(l,d),p=(0,w.usePlan)(l),k=(0,h.useBookings)(l),T=(0,w.tablesOf)(e.table),S=i.default.useMemo(()=>Object.fromEntries(Object.entries(c).map(([e,t])=>[e,T.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[c,e.table]),C=i.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(S).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(p,k.filter(e=>e.date===(0,y.ymd)(d)),t,e.partySize,d,(0,f.turnFor)(e.partySize,n.settings.turnMins),90,e.id)?.table??null},[p,k,S,e.partySize,d.getTime()]),[v,D]=(0,a.useState)(!!o||T.length>1),[$,P]=(0,a.useState)(T),O=e=>p.tables.find(t=>t.name===e)?.maxSeats??0,R=$.reduce((e,t)=>e+O(t),0),F=$.length>0&&R{const o=(0,w.joinTables)(s);await h.repo.bookings.assignTable(e.id,o);T.filter(e=>!s.includes(e)).forEach(t=>w.useFloor.getState().setLive(l,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&z(l,o),t()},L=v?(0,I.jsxs)(u.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,I.jsx)(u.default,{accessibilityLiveRegion:"polite",children:(0,I.jsx)(j.T,{size:17,weight:"semibold",colour:x.colours.text,children:$.length?`${(0,w.tablesLabel)((0,w.joinTables)($))} \xb7 ${R} seats for ${e.partySize} covers`:'No tables picked yet'})}),F?(0,I.jsx)(u.default,{testID:"combine-short",children:(0,I.jsxs)(j.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-R," more needed. Add another table."]})}):null,(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,I.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,I.jsx)(j.Button,{label:"Done",testID:"combine-done",disabled:!$.length,accessibilityLabel:$.length?`Done, save ${(0,w.tablesLabel)((0,w.joinTables)($))}`:'Done',onPress:()=>A($)}),(0,I.jsx)(j.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,I.jsx)(u.default,{style:{gap:8},testID:"assign-table-tip",children:(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`${v?'Combine tables':'Assign table'} \xb7 ${M(e)}`,testID:"assign-table-sheet",footer:L,children:[C&&!v?(0,I.jsx)(u.default,{testID:"assign-suggested",children:(0,I.jsxs)(j.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:["Suggested for ",e.partySize,": ",(0,s.tableNumbers)(C)]})}):null,v?null:(0,I.jsx)(j.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,I.jsx)(N,{use:S,best:v?null:C,bestSet:(0,r.bestTables)(p),picked:v?$:void 0,onPick:v?e=>P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await A([e])}})]})}function L(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${M(e)} seated \xb7 ${e.table?`${(0,s.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>h.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function W({date:e,onClose:t,wide:n,onSaved:i}){const{rid:r,r:d,now:c,role:P,meId:O}=(0,b.useCtx)(6e4),z=(0,y.ymd)(c),[B,M]=(0,a.useState)(ee.blocks),[F,A]=(0,a.useState)(!1),[L,W]=(0,a.useState)(''),[E,H]=(0,a.useState)(2),[_,U]=(0,a.useState)(null),[q,V]=(0,a.useState)(''),[G,K]=(0,a.useState)(''),[Q,Y]=(0,a.useState)(''),[J,X]=(0,a.useState)('phone'),[Z,ee]=(0,a.useState)((0,C.emptyNeeds)()),te=(0,C.needsMissing)(Z),[se,oe]=(0,a.useState)(null),le=(0,w.usePlan)(r),ne=(0,$.dogSetUp)(le),ae=!0===Z.dog&&ne,ie=Z.dog?Z.dogs:0,re=(0,y.parseYmd)(B),de=(0,f.turnFor)(E,d.settings.turnMins),ue=N.filter(e=>e.date===B),ce=e=>(0,f.freeTablesAt)(le,ue,E,new Date(`${B}${(0,s.tableNumbers)(e)}:00`),de,d.settings.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(R,r,B,e)}),be=ae&&_?ce(_):[];(0,a.useEffect)(()=>{oe(null)},[ae,_,E]);const he=(0,p.bookingSlots)(d,re,e=>N.filter(t=>t.date===B&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),E,B===(0,y.ymd)(c)?c:(0,y.addMins)(re,0)),ge=(0,k.ukPhone)(G),pe=_?(0,T.blockAt)(R,r,B,_):void 0,me='staff'!==P,fe=!!_&&!(0,C.dogTimeOk)(d,N,B,_,ie),ye=!te.length&&L.trim().length>=2&&!!_&&ge.ok&&(0,k.emailOk)(Q)&&(!pe||me&&F)&&(!ae||be.length>0)&&!fe,xe=Z.wheelchair>0||Z.stepFree;return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,y.niceDate)(re)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,I.jsx)(C.FirstQuestions,{rid:r,value:Z,onChange:ee,party:E,audience:"staff"}),Z.dog&&!ne?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,I.jsx)(S.BookingDatePicker,{r:d,today:c,value:B,onChange:e=>{e!==B&&(M(e),U(null),A(!1))}}),(0,I.jsxs)(j.Row,{gap:6,children:[(0,I.jsx)(j.Chip,{label:"Phone",selected:'phone'===J,onPress:()=>X('phone')}),(0,I.jsx)(j.Chip,{label:"In person",selected:'in-person'===J,onPress:()=>X('in-person')})]}),(0,I.jsx)(j.Field,{label:"Name",value:L,onChangeText:W,placeholder:"e.g. Reid",testID:"nb-name"}),(0,I.jsx)(j.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!ge.ok&&G?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:ge.error}):null,(0,I.jsx)(j.Field,{label:"Email (optional)",value:Q,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,k.emailOk)(Q)?null:(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(j.T,{children:"Covers"}),(0,I.jsx)(j.Stepper,{value:E,onChange:H,min:1,max:20,label:"covers"})]}),(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:he.map(e=>{const t=ae&&e.available&&!ce(e.time).length||!(0,C.dogTimeOk)(d,N,B,e.time,ie);return(0,I.jsx)(j.Chip,{label:e.time,sub:(0,T.blockAt)(R,r,B,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':`${e.left} left`,disabled:!e.available||t,selected:_===e.time,onPress:()=>{U(e.time),A(!1)}},e.time)})}),ae&&_?(0,I.jsxs)(u.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,I.jsxs)(j.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,I.jsxs)(j.T,{size:13,colour:x.colours.muted,children:["(",le.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),be.length?(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:be.slice(0,10).map((e,t)=>(0,I.jsx)(j.Chip,{label:`${(0,s.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${xe&&(0,$.accessibleSetUp)(le)&&!(0,$.isAccessible)(le,e.table)?' \xb7 not step-free':''}`,selected:(se??be[0].table)===e.table,onPress:()=>oe(e.table)},e.table))}):(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["No dog-friendly table free for ",E," at ",_,". Try another time."]})]}):null,pe?(0,I.jsxs)(u.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:x.colours.amber,backgroundColor:x.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,I.jsxs)(j.T,{weight:"semibold",colour:x.colours.amber,children:["Bookings are paused ",pe.from,"\u2013",pe.to,pe.reason?` (${pe.reason})`:'']}),me?(0,I.jsx)(j.Chip,{label:F?'Manager override on':'Override and book anyway',selected:F,onPress:()=>A(e=>!e)}):(0,I.jsx)(j.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,he.length?null:(0,I.jsx)(u.default,{testID:"nb-closed",children:(0,I.jsxs)(j.T,{size:14,weight:"semibold",colour:x.colours.amber,children:["Closed on ",(0,y.niceDate)(re)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,I.jsx)(C.MoreQuestions,{rid:r,r:d,value:Z,onChange:ee,party:E,date:B,time:_,today:(0,y.ymd)(c),bookings:N,audience:"staff",showTables:!1!==d.settings.tableRequests}),xe&&!(0,$.accessibleSetUp)(le)?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,I.jsx)(j.Field,{label:"Notes (optional)",value:q,onChangeText:V,placeholder:v.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,l.depositDue)((0,l.depositOf)(d.settings),E)?(0,I.jsxs)(j.Muted,{children:["Deposit due: ",(0,o.gbp)((0,l.depositDue)((0,l.depositOf)(d.settings),E))," (",(0,o.gbp)((0,l.depositOf)(d.settings).perPersonPence)," per person for ",(0,l.depositOf)(d.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,I.jsxs)(j.Muted,{children:["The guest gets a confirmation text",Q.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),fe?(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["We already have the most dogs we can look after at ",_,". Try another time: dogs are very welcome then."]}):null,(0,I.jsx)(j.Button,{label:te.length?te[0]:'Save booking',testID:"nb-save",disabled:!ye,onPress:()=>{if(B<(0,y.ymd)(c))return;const e=(0,C.needsPatch)(Z),s=Z.tableReq.find(e=>!ae||be.some(t=>t.table===e));h.repo.bookings.create({restaurantId:r,customerId:null,name:L.trim(),partySize:E,date:B,time:_,notes:q.trim(),security:(0,l.depositDue)((0,l.depositOf)(d.settings),E)?'deposit':'none',depositPaid:0,...(0,l.depositDue)((0,l.depositOf)(d.settings),E)?{depositDue:(0,l.depositDue)((0,l.depositOf)(d.settings),E),depositPolicy:(0,l.depositWords)((0,l.depositOf)(d.settings),E,d.name).join(' '),depositRefundable:(0,l.depositOf)(d.settings).refundable,depositCutoffHours:(0,l.depositOf)(d.settings).cutoffHours}:{},phone:ge.pretty,email:Q.trim()||void 0,source:J,...e,...he.find(e=>e.time===_)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ae?{table:se??s??be[0]?.table}:{}}).then(e=>(0,D.postNewBookingToKitchen)(e,O)).catch(()=>{}),i?.({date:B,time:_,name:L.trim()}),t()}})]})}},926,[877,808,816,13,919,30,945,263,127,806,927,819,817,826,818,821,823,813,825,824,1298,827,812,950,828,24]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return y}}),_e.useShiftManager=D,_e.useSignedIn=b,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(p),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),d=b(),m=o||'staff'===s.APP_VARIANT,w=(0,t.useContext)(y),h=D(),O=m?w&&h?'manager':'staff':d?l(i,d.role):i,S=(0,r.useOwner)(e=>e.staff),M=(0,n.useRestaurant)(u),A=(0,n.useNow)(e),I=d?d.id:m&&f?f:c[O],P=S.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:M,now:A,role:O,me:P,meId:I,today:(0,a.venueYmd)(A),signedIn:!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return O}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,o.isLive)())return;const s=r.useOwner.getState(),u=[],i=s.staff.find(e=>e.active&&'manager'===e.role)??s.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-h(n));const d=(0,a.ymd)(f),c=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(s.attendance.some(e=>e.date===r))continue;const o=s.shifts.filter(e=>e.date===r&&!1!==e.published);(o.length?o:s.shifts.filter(e=>e.day===h(t)&&e.date>=d&&e.date<=c&&!1!==e.published)).forEach((n,a)=>{const s=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),o=n.end-n.start,f=o>8?30:o>6?20:0,d=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};u.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,s(1)),out:m(t,n.end,s(2)),inSite:!0,outSite:!0,breakMins:f,...d})})}u.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...u]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return S}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const s='weekly'===e?7:14,o=new Date(r);o.setDate(r.getDate()-h(r));let u=new Date(o);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((o.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*s);const i=new Date(u);return i.setDate(u.getDate()+s-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=b(),t=(0,r.useOwner)(e=>e.hourly);return e?t:M};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),d=_r(_d[10]);const c={owner:f.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:f.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:f.ROSTER.find(e=>'staff'===e.app)?.id??''},m={staff:0,manager:1,owner:2},l=(e,t)=>m[e]>m[t]?t:e,p=(0,t.createContext)(!1),w=()=>(0,t.useContext)(p),y=(0,t.createContext)(!1);function D(){const e=(0,t.useContext)(p)||'staff'===s.APP_VARIANT,n=b(),r=(0,o.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,o.useSync)(e=>e.perms);return(0,u.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,i.rosterPerson)(n?.id)?.app,live:r,perms:a})}function b(){const e=(0,i.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const h=e=>(e.getDay()+6)%7,O=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const S=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const M={}},927,[833,30,819,856,818,806,820,1031,859,14,1030]);
+__d(function(_g,_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,"snap",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return y}}),_e.areaBounds=w,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,c.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=M,_e.FixtureShape=j,_e.FloorCanvas=function(e){const[v,k]=(0,n.useState)({w:0,h:0}),C=e.plan.tables.filter(t=>t.areaId===e.areaId),I=e.crop&&C.length?w(e.plan,e.areaId):{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H},z={x:I.x,y:I.y,r:I.x+I.w,b:I.y+I.h},R=v.w?'width'===e.fit?Math.min(v.w/s.PLAN_W,e.maxH?e.maxH/s.PLAN_H:9):Math.min(v.w/I.w,v.h/I.h):0,S=e.fill&&'contain'===e.fit&&R>0&&v.h>0,$=S?(v.w/R-I.w)/2:0,A=S?(v.h/R-I.h)/2:0,T={x:z.x-$,y:z.y-A,r:z.r+$,b:z.b+A},L=T.r-T.x,E=T.b-T.y,[N,F]=(0,n.useState)(null),_=(0,n.useRef)(null),B=t=>e.plan.sections.find(e=>e.id===t.sectionId),P=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),D=r.default.useMemo(()=>(0,c.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),O=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{_.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=_.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(s)<6&&!N||('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&F({id:t.id,dx:i,dy:s,kind:o})},onResponderRelease:n=>{const r=_.current;_.current=null;const i=n.nativeEvent.pageX-(r?.x??0),a=n.nativeEvent.pageY-(r?.y??0);if(F(null),Math.abs(i)+Math.abs(a)<6||!R)return void('move'===o&&e.onTap?.(t));const l=i/R,u=a/R;if('edit'===e.mode&&'move'===o)e.onMove?.(t,p(g(t.x+l,e.snapOn),0,s.PLAN_W-t.w),p(g(t.y+u,e.snapOn),0,s.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,p(g(t.w+l,e.snapOn),50,400),p(g(t.h+u,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+l,n=t.y+t.h/2+u,r=C.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),W=e=>e*R,H='width'===e.fit?s.PLAN_H*R||200:void 0;return(0,b.jsx)(i.default,{testID:"floor-canvas",onLayout:e=>k({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:H}],children:R?(0,b.jsx)(i.default,{style:{width:W(L),height:W(E),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:l.colours.border,overflow:'hidden'},children:(0,b.jsxs)(i.default,{style:{position:'absolute',left:-W(T.x),top:-W(T.y),width:W(s.PLAN_W),height:W(s.PLAN_H)},children:['edit'===e.mode?Array.from({length:s.PLAN_W/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',left:W(o*s.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:s.PLAN_H/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',top:W(o*s.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,b.jsx)(j,{f:t,S:W,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=C.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,s=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-s),h=Math.atan2(l-s,a-r);return(0,b.jsx)(i.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:W((r+a)/2-u/2),top:W((s+l)/2)-3,width:W(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),C.map(n=>{const g=e.view?.[n.name],p=g?a.STATUS[g.status]:a.STATUS.free,v=N?.id===n.id,w=v&&'resize'===N.kind?Math.max(50,n.w+N.dx/R):n.w,j=v&&'resize'===N.kind?Math.max(50,n.h+N.dy/R):n.h,k=v&&'move'===N.kind?n.x+N.dx/R:n.x,C=v&&'move'===N.kind?n.y+N.dy/R:n.y,I=e.selected===n.id||e.highlight?.includes(n.name),z=B(n),S='edit'===e.mode?'#2A2419':p.colour,$='edit'===e.mode?l.colours.text:p.fg,A='round'===n.shape?W(Math.min(w,j))/2:W(10),T='live'===e.mode?(0,c.liveTableLabel)(n,D):(0,s.tableLabel)(n),L=W(Math.min(w,j))<64,E=f(e.big?Math.max(13,Math.min(34,W(Math.min(w,j))/3)):Math.max(11,Math.min(22,W(Math.min(w,j))/4)),T,W(w)*('round'===n.shape?.85:1),e.big?y:9),F=Math.max(e.big?11:12,Math.round(.62*E)),_=(W(j)-6-1.4*E)/(1.4*F),H=_>=2&&W(w)>=5*F?2:_>=1?1:0,G=g?g.booking&&void 0!==g.seatedMins?g.booking.time:g.next?.time:void 0,X='edit'===e.mode?`${(0,o.tableNumbers)(T)}, ${(0,s.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:`${(0,o.tableNumbers)(T)}, ${p.label}${void 0!==g?.seatedMins?`, seated ${g.seatedMins} min`:''}${g?.covers?`, ${g.covers} covers`:''}${void 0!==g?.nextIn&&'seated'!==g.status?`, next booking ${g.next?.time}`:''}${g?.dayBookings?.length?`, booked: ${g.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${g?.group?`, combined with ${g.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,Y=void 0!==g?.seatedMins&&g.booking?Math.min(1.2,g.seatedMins/(g.booking.durationMins??(0,a.turnFor)(g.booking.partySize,e.turnBase))):null;return(0,b.jsxs)(r.default.Fragment,{children:[M({...n,w:w,h:j}).map((t,o)=>(0,b.jsx)(i.default,{pointerEvents:"none",style:[{position:'absolute',left:W(k+t.x)-Math.max(4,W(8)),top:W(C+t.y)-Math.max(4,W(8)),width:Math.max(8,W(16)),height:Math.max(8,W(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?l.colours.gold:'rgba(255,255,255,0.25)'},x()]},o)),'live'===e.mode&&(W(w)<44||W(j)<44)?(0,b.jsx)(i.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...O(n,'move'),style:{position:'absolute',left:W(k+w/2)-Math.max(44,W(w))/2,top:W(C+j/2)-Math.max(44,W(j))/2,width:Math.max(44,W(w)),height:Math.max(44,W(j)),zIndex:2}}):null,(0,b.jsxs)(i.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:X,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...O(n,'move'),style:[{position:'absolute',left:W(k),top:W(C),width:W(w),height:W(j),borderRadius:A,backgroundColor:S,alignItems:'center',justifyContent:'center',padding:2,borderWidth:I?3:e.sectionColours&&z?2.5:1.5,borderColor:I?'#FFFFFF':e.sectionColours&&z?(0,l.brandColour)(z.colour):'edit'===e.mode?l.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:x()],children:[(0,b.jsxs)(i.default,{style:{alignItems:'center'},pointerEvents:"none",children:[(0,b.jsx)(u.T,{weight:"bold",size:E,colour:$,center:!0,numberOfLines:1,children:T}),'live'===e.mode&&'blocked'===g?.status?(0,b.jsx)(u.T,{size:Math.max(10,Math.round(.5*E)),weight:"semibold",colour:$,center:!0,numberOfLines:1,children:"Blocked"}):null,e.big&&'live'===e.mode&&g&&1===H?g.covers||G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,numberOfLines:1,children:'free'===g.status||'soon'===g.status?G?`${g.dayBookings?'Booked':'Next'} ${G}`:'':[g.covers?`${g.covers}`:'',G??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&g&&2===H?(0,b.jsxs)(b.Fragment,{children:[g.covers?(0,b.jsxs)(u.T,{size:F,weight:"semibold",colour:$,center:!0,children:[g.covers," cover",1===g.covers?'':'s']}):'free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:F,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,children:'free'===g.status||'soon'===g.status?`${g.dayBookings?'Booked':'Next'} ${G}`:G}):'dirty'===g.status?(0,b.jsx)(u.T,{size:F,colour:$,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?L?null:(0,b.jsxs)(u.T,{size:11,colour:l.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):g?(0,b.jsxs)(b.Fragment,{children:['free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==g.seatedMins?(0,b.jsxs)(u.T,{size:12,weight:"semibold",colour:$,center:!0,children:[g.seatedMins,"m \xb7 ",g.covers,"\ud83d\udc65"]}):g.orderOnly?(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Open order"}):null,'soon'===g.status&&g.next?(0,b.jsxs)(u.T,{size:11,weight:"semibold",colour:$,center:!0,children:[g.next.time," \xb7 ",void 0===g.nextIn?`${g.next.partySize} Covers`:g.nextIn<=0?'due':`${g.nextIn}m`]}):null,'dirty'!==g.status||L?null:(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Clear"}),!L||g.allergy||g.vip?(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[g.allergy?'\u26a0':'',g.vip?'VIP'===g.vip?'\u2605':'\u2665':'',g.occasion?a.OCCASION_ICON[g.occasion]:'',g.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&g&&!L&&(g.booking??g.next)&&(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*F):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,b.jsx)(u.T,{size:e.big?Math.max(11,.75*F):10,children:(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()})}):null,z&&'live'===e.mode&&e.sectionColours&&!L&&!e.big?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,l.brandColour)(z.colour),borderRadius:6,paddingHorizontal:3},children:(0,b.jsx)(u.T,{size:9,weight:"bold",colour:"#0B0B0B",children:z.server})}):null,null===Y||L?null:(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,b.jsx)(i.default,{style:{width:`${Math.min(100,100*Y)}%`,height:4,borderRadius:2,backgroundColor:Y>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),'live'===e.mode&&g?.group?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`group-${n.name}`,style:{position:'absolute',top:e.big?-Math.max(10,.6*F):2,right:e.big?-6:3,backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:5,borderWidth:1.5,borderColor:l.colours.gold},children:(0,b.jsxs)(u.T,{size:e.big?Math.max(12,.8*F):10,weight:"bold",colour:l.colours.goldLight,children:["\u26d3 ",(U=g.group,(0,s.tablesLabel)(U.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+'))]})}):null,P(n)&&'edit'===e.mode?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,b.jsx)(u.T,{size:10,colour:l.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,b.jsx)(i.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...O(n,'resize'),style:{position:'absolute',left:W(k+w)-14,top:W(C+j)-14,width:28,height:28,borderRadius:14,backgroundColor:l.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id);var U}),0===C.length?(0,b.jsx)(i.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,b.jsxs)(u.T,{center:!0,colour:l.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n);_r(d[3]);var i=e(_r(d[4])),s=_r(d[5]),a=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]);const x=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),g=(e,t=!0)=>t?Math.round(e/s.GRID)*s.GRID:Math.round(e),p=(e,t,o)=>Math.max(t,Math.min(o,e)),f=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),y=12,v=46;function w(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-v),r=Math.max(0,Math.min(...o.map(e=>e.y))-v);return{x:n,y:r,w:Math.min(s.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+v)-n,h:Math.min(s.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+v)-r}}function M(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':l.colours.gold},a],children:(0,b.jsx)(u.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:l.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(s?e.h:e.w)>60?(0,b.jsx)(u.T,{size:9,colour:"#BFDDFF",style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':l.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(s?e.h:e.w)>40?(0,b.jsx)(u.T,{size:9,colour:l.colours.goldLight,style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}},928,[868,808,30,122,127,825,826,821,813,950,945,24]);
+__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return u}}),_e.AreaTabs=function({plan:o,area:e,onPick:n,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const f=o.id===e,h=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${h?', closed for weather':''}`,accessibilityState:{selected:f},onPress:()=>n(o.id),style:{minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:f?s.colours.gold:h?s.colours.blue:s.colours.border,backgroundColor:f?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:f?s.colours.onGold:s.colours.text,children:[o.name,u(o),h?(0,c.jsx)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const u=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},929,[30,263,821,813,24]);
+__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=j,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:f=90,onClose:v,onSaved:w,onPickOnPlan:T}){const $=(0,b.usePlan)(e),C=(0,c.useBookings)(e),[L,P]=(0,s.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),S=(0,s.useMemo)(()=>(0,h.pickGroups)($),[$]),W=C.filter(e=>e.date===u.date),z=(0,h.seatsOf)($,L),O=(0,h.seatLine)(z.total,u.partySize),D=(0,h.pickClashes)(u,L,W,f),I=e=>(0,h.pickClashes)(u,[e],W,f)[0]?.with,B=(0,h.tableKey)(L)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),_=e=>P(l=>(0,h.toggleTable)(l,e)),M=async l=>{await j(e,u,l),w?.((0,h.savedWords)(p,u.partySize,l,(0,h.seatsOf)($,l).total)),v()},R=(0,k.jsxs)(n.default,{style:{gap:8},children:[(0,k.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(L)} picked. ${O.text}.`,children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(L)}),(0,k.jsx)(y.T,{size:17,colour:g.colours.text,children:O.text})]}),D.length?(0,k.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(D)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,k.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(D)," You can still save."]})}):null,(0,k.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(y.Button,{testID:"table-pick-save",label:D.length?'Save anyway':'Save tables',disabled:!B||!L.length,accessibilityLabel:`${D.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(L)} for ${p}. ${O.text}.${D.length?` ${(0,h.clashWords)(D)}`:''}`,onPress:()=>M(L),style:[x,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,k.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>M([]),style:x}):null,(0,k.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:x})]})]});return(0,k.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:R,children:[(0,k.jsx)(l.TableNumberWarning,{plan:$}),(0,k.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,k.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(L),style:x}):null,S.map(e=>(0,k.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,k.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,k.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const l=L.includes(e.name),s=I(e.name);return(0,k.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:l},'aria-checked':l,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,l,s),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:l?2:1,borderColor:l?g.colours.gold:s?g.colours.goldMuted:g.colours.hairline,borderStyle:s&&!l?'dashed':'solid',backgroundColor:l?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:l?g.colours.onGold:g.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,k.jsxs)(y.T,{size:14,colour:l?g.colours.onGold:g.colours.muted,children:[e.seats," seats",s?' \xb7 booked':'']})]},e.name)})})]},e.area)),S.length?null:(0,k.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var l=r(d[0]),t=r(d[1]),s=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),f=r(d[12]),k=r(d[13]);const x={minHeight:56};async function j(e,l,t){const s=(0,h.tableKey)(t),o=(0,b.tablesOf)(l.table);await c.repo.bookings.update(l.id,(0,u.tablePatch)(s||null)),'seated'===l.status&&l.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(s).includes(e)).forEach(l=>b.useFloor.getState().setLive(e,l,{stage:void 0,dirty:!0})),s&&(0,f.resetTableLive)(e,s))}},930,[914,808,30,263,127,819,825,1297,931,821,818,813,926,24]);
+__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},931,[808,826]);
+__d(function(g,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,"ds",{enumerable:!0,get:function(){return h}}),_e.useCss=function(){(0,n.useEffect)(()=>{if(!x||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=k,document.head.appendChild(e)},[])},_e.KindIcon=function({kind:e,size:t=22,colour:n}){const a={stroke:n??m.KIND_META[e].colour,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,b.jsxs)(l.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...a})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...a}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...a})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...a}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...a})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...a})]}):null,'test'===e?(0,b.jsx)(o.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...a}):null]})},_e.SoundToggle=function({big:e}){const t=(0,m.useAlerts)(e=>e.prefs.muted);return(0,b.jsx)(a.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>m.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:d.colours.border},children:(0,b.jsx)(u.T,{size:e?15:12,colour:t?d.colours.muted:d.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:a,onOpen:s,skipTakeaway:o}){const l=(0,m.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind||o&&'takeaway'===n.kind&&!n.test)),c=e=>'booking'===e.kind||'pending'===e.kind,d=l.filter(c),u=l.filter(e=>!c(e));A('managers'===e);const x=u.map(e=>e.id+':'+e.at).join('|'),h=(0,n.useRef)({me:a,onOpen:s});return h.current={me:a,onOpen:s},(0,n.useEffect)(()=>{const t=new Set(u.map(e=>`alert:${e.id}`));f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of u){const n=m.KIND_META[t.kind],a='display'===e;(0,f.notify)({id:`alert:${t.id}`,tone:T(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${y(t.at)}`,title:t.name,timeoutMs:S(t,e),content:({close:n})=>(0,b.jsx)(I,{a:t,variant:e,big:a,me:h.current.me,onOpen:h.current.onOpen,close:n}),onClose:()=>m.useAlerts.getState().dismiss(t.id)})}},[x,e]),(0,n.useEffect)(()=>()=>f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,b.jsx)(p.BookingBanners,{alerts:d,big:'display'===e,managers:'managers'===e,me:a,onOpen:s,onClose:e=>m.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]);r(_d[2]);var a=e(r(_d[3])),s=e(r(_d[4])),o=r(_d[5]),l=e(o),c=r(_d[6]),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]);const x='undefined'!=typeof document,h=e=>({dataSet:{ccal:e}}),k="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function w({label:e,value:t,big:n}){return(0,b.jsxs)(s.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,b.jsx)(u.T,{size:n?13:10,weight:"semibold",colour:f.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,b.jsx)(u.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function j({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,b.jsx)(f.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const S=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,T=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function I({a:e,variant:a,big:o,me:l,onOpen:p,close:m}){const[x,h]=(0,n.useState)(!1),[k,y]=(0,n.useState)(null),S=e=>{y(e),setTimeout(m,1800)},T='managers'===a,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,b.jsxs)(s.default,{testID:`alert-${e.kind}`,style:{gap:o?12:8},children:['email'===e.kind?(0,b.jsx)(u.T,{size:o?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:A.map(([e,t])=>(0,b.jsx)(w,{label:e,value:t,big:o},e))}):null,e.allergy?(0,b.jsxs)(s.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:d.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:o?12:8},children:[(0,b.jsx)(u.T,{size:o?16:11,weight:"bold",colour:d.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,b.jsxs)(s.default,{style:{flex:1},children:[(0,b.jsx)(u.T,{size:o?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,b.jsx)(u.T,{size:o?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==a?(0,b.jsx)(u.T,{size:o?18:13,colour:d.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,b.jsx)(u.T,{size:12,colour:f.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,b.jsx)(u.T,{size:14,weight:"semibold",colour:d.colours.goldLight,children:k}):null,(0,b.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[T&&!k?'pending'===e.kind?x?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(u.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,b.jsx)(j,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',I),S('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(j,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',I),S(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(j,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I);S(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(j,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I,t);S(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(j,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(j,{kind:"ghost",label:!T||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:m})]})]})}function A(e){const t=(0,m.useAlerts)(e=>e.askedSystem);(0,n.useEffect)(()=>{if(!e||t||'default'!==(0,m.systemSupport)())return;const n=setTimeout(()=>(0,f.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,m.requestSystemPermission)().then(()=>m.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>m.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},932,[808,30,122,263,127,948,819,821,813,1349,919,934,24]);
+__d(function(g,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,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},933,[30,127,287,819,814,934,923,821,813,919,24]);
+__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},934,[1350,1351,1353,1352,1354,923,1355]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=p,_e.BlockBookingsSheet=B,_e.BlocksBanner=function({rid:e,now:o,big:s,by:l="staff"}){const t=(0,i.useBlocks)(e=>e.blocks),r=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(t,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(n.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\u23f8"}),(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.amber,style:{flex:1},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",testID:"blocks-undo",onPress:()=>{r(a.id,l),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:j,tile:k,display:p}){const[y,w]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),v=(0,i.currentBlocks)(C,e,(0,c.ymd)(a),(0,c.hm)(a)).length;return k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:v?`${v} block${1===v?'':'s'} on now`:'Pause online times',count:v||void 0,onPress:()=>w(!0),accessibilityLabel:"Block bookings"}),y?(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:"Block bookings",onPress:()=>w(!0),style:({pressed:e})=>j?{...t.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[j?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:j?15:x?22:17,weight:"semibold",colour:j?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),v?(0,f.jsx)(n.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:v})}):null]}),y?p?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>w(!1)}):(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]})},_e.closeOutdoor=C,_e.useOutdoor=v,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:n,big:a,quiet:d,short:c,tile:h}){const m=v(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(l.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(r.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...t.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),t=_r(_d[3]),r=e(_r(_d[4])),n=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),j=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function k({title:e,sub:o,onPress:s,testID:l,disabled:t}){return(0,f.jsxs)(r.default,{testID:l,accessibilityRole:"button",accessibilityLabel:e,disabled:t,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:t?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function p({rid:e,now:l,by:t="staff"}){const r=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(l),k=(0,i.currentBlocks)(r,e,x,(0,c.hm)(l));return k.length?(0,f.jsxs)(n.default,{style:{gap:8},testID:"block-list",children:[k.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(l));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',j(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${j(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,t),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:l,max:t}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(l,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(t,o+30))})]})}function B({rid:e,r:o,now:l,by:t,onClose:r,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[j,B]=(0,s.useState)(),C=(0,c.ymd)(l),v=(0,d.hoursFor)(o,l),M=v?(0,c.hm)(v.close):null,P=x(l),T=!!v&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const t=new Date(l);t.setHours(12,0,0,0),t.setDate(t.getDate()+s),(0,d.hoursFor)(o,t)&&e.push(t)}return e},[C,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):C),S=(0,d.hoursFor)(o,(0,c.parseYmd)($)),L=S?(0,c.toMins)((0,c.hm)(S.open)):720,F=S?(0,c.toMins)((0,c.hm)(S.close)):1260,[W,A]=(0,s.useState)(null),N=W??{from:L,to:F},H=(o,s,l)=>{u({rid:e,date:o,from:s,to:l,reason:j,by:t}),r()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:r,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(k,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(k,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:l,by:t,onDone:r}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(p,{rid:e,now:l})]}):'today'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(k,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(C,P,M)}),(0,f.jsx)(k,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(C,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===L&&N.to===F,onPress:()=>A({from:L,to:F})}),L<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(L)}\u201317:00`,selected:N.from===L&&1020===N.to,onPress:()=>A({from:L,to:Math.min(1020,F)})}):null,F>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(F)}`,selected:1020===N.from&&N.to===F,onPress:()=>A({from:Math.max(1020,L),to:F})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:L,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:F,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function C(e,o,s,l,t){const r=(0,d.hoursFor)(o,s),n=x(s),a=r?(0,c.hm)(r.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(n)?a:'23:59';return t.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:n,to:u,reason:'Weather',by:l,areaId:o.id,areaName:o.name}))}function v(e,o){const s=(0,a.usePlan)(e),l=(0,i.useBlocks)(e=>e.blocks),t=s.areas.filter(e=>e.outdoor),r=(0,i.closedAreasAt)(l,e,(0,c.ymd)(o),(0,c.hm)(o)),n=l.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:t,closed:r,active:n,allClosed:t.length>0&&t.every(e=>r.has(e.id))}}function D({rid:e,r:o,now:s,by:l,onDone:t}){const r=v(e,s);return!r.outdoor.length||r.allClosed?null:(0,f.jsx)(k,{testID:"block-garden",title:"Close garden for weather",sub:`${r.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{C(e,o,s,l,r.outdoor.filter(e=>!r.closed.has(e.id))),t()}})}function M({rid:e,now:o,big:s}){const l=v(e,o);if(!l.active.length)return null;const t=[...new Set(l.active.map(e=>e.areaName??'Garden'))].join(', '),r=l.active.map(e=>e.to).sort().slice(-1)[0],a=l.plan.areas.filter(e=>e.dogs&&!l.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(n.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}),(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.blue,children:[t," closed for weather until ",r]}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",a.length?` Dogs can still sit in the ${a.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",testID:"garden-reopen",onPress:()=>l.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},935,[808,30,1339,937,263,127,824,825,815,818,821,813,1023,1395,24]);
+__d(function(g,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_BACK",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return h}}),_e.dayWord=p,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return x}}),_e.bookingsForDay=D,_e.dayCovers=function(e,t,o){if(t>=o)return(0,s.coversToday)(e,t);const n=D(e,t,o),d=(c=n.filter(e=>(0,s.coverDone)(e)||'seated'===(0,s.shownStatus)(e)),c.reduce((e,t)=>e+t.partySize,0)),l=(0,s.coversToday)(e,t).total;var c;return{done:d,toCome:Math.max(0,l-d),total:l}},_e.DaySwitch=function({day:e,today:s,onDay:b,back:D=u,ahead:j=y,idPrefix:$="display-day",stacked:P=!1}){const T=f(e,s),v=t=>{const o=h(e,t);b(o===s?null:o)},w=h(e,-1),C=h(e,1),Y=0!==T,I=(e,o,s,d,u)=>(0,c.jsx)(t.default,{testID:u,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:d},disabled:d,onPress:s,style:({pressed:e})=>({minHeight:44,minWidth:P?0:92,flex:P?1:void 0,paddingHorizontal:P?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:d?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,c.jsx)(n.T,{center:P,size:P?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:P?void 0:1,children:e})}),L=p(e,s);return P?(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:Y?l.colours.gold:l.colours.hairline,backgroundColor:Y?l.colours.goldTint:l.colours.surface},children:[(0,c.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${L}, ${x(e)}`,style:{gap:2,alignItems:'center'},children:[(0,c.jsx)(n.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:L}),(0,c.jsx)(n.T,{center:!0,size:16,children:x(e)})]}),(0,c.jsxs)(o.default,{style:{flexDirection:'row',gap:8,justifyContent:'center'},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),I('Today','Back to today',()=>b(null),!1,'back-to-today'),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})]}):(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',gap:8},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),(0,c.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:Y?'button':'text',disabled:!Y,onPress:()=>b(null),accessibilityLabel:Y?`Showing ${L===(0,d.niceDate)((0,d.parseYmd)(e))?'':`${L}, `}${x(e)}. Back to today`:`Showing today, ${x(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:Y?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:Y?l.colours.goldTint:'transparent'}),children:[(0,c.jsx)(n.T,{size:15,weight:"semibold",colour:Y?l.colours.gold:l.colours.text,numberOfLines:1,children:Y&&L!==(0,d.niceDate)((0,d.parseYmd)(e))?`${L} \xb7 ${(0,d.niceDate)((0,d.parseYmd)(e))}`:L}),Y?(0,c.jsx)(n.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),n=r(_d[3]),s=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]);const u=365,y=365,b=12e4,f=(e,t)=>Math.round(((0,d.parseYmd)(e).getTime()-(0,d.parseYmd)(t).getTime())/864e5),h=(e,t)=>(0,d.ymd)((0,d.addMins)((0,d.parseYmd)(e),1440*t+120));function p(e,t){const o=f(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,d.niceDate)((0,d.parseYmd)(e))}const x=e=>(0,d.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});function D(e,t,o){return e.filter(e=>e.date===t&&(0,s.ACTIVE)(e))}},936,[30,263,127,813,828,818,821,24]);
+__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}},937,[5,1233,1204,868,122,1236]);
+__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useReservedToday=k,_e.ShellfishTile=function({rid:e,by:t,app:l,big:c,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),p=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),L=(0,o.useLiveState)();if('ready'!==L)return(0,f.jsx)(o.LiveWait,{state:L,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const $=y.items.filter(e=>y.isLow(e.key)),T=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(r.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:$.length?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface,padding:c?10:12,gap:6},b],children:[(0,f.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:c?1:void 0},children:[(0,f.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:["LIVE \xb7 ",T]}),(0,f.jsx)(n.T,{size:12,colour:u.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(n.Row,{gap:c?14:18,style:{flex:c?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(n.T,{size:c?42:34,weight:"bold",colour:s<=0?u.colours.red:o?u.colours.amber:u.colours.text,style:{lineHeight:c?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,f.jsxs)(n.T,{size:13,colour:o?u.colours.amber:u.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!c&&$.length?(0,f.jsxs)(r.default,{testID:"shellfish-low",style:{backgroundColor:u.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",$.map(t=>`${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,a.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),h?(0,f.jsx)(n.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,c||$.length||!h?null:(0,f.jsx)(i.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(n.T,{size:13,colour:u.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,f.jsx)(j,{rid:e,by:t,app:l,onClose:()=>C(!1),onOrder:h?()=>{C(!1),h()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:o,height:c=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x=c>=80,w=Math.max(28,Math.min(52,Math.round(.6*c))),C=Math.max(22,Math.min(34,Math.round(.42*c)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,h.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:c,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...l.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,i=b[t.key]??0,d=Math.max(0,o-i),y=d<=0,p=y||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,d)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:x?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...l.look.web(p?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,f.jsx)(n.T,{size:C,children:t.icon}),(0,f.jsx)(n.T,{size:w,weight:"bold",colour:p?'#FF8E82':u.colours.text,style:{lineHeight:Math.round(1.15*w),letterSpacing:-.5,minWidth:Math.round(.85*w),textAlign:'center'},children:(0,a.fmtStockCount)(e,t,d)}),(0,f.jsxs)(r.default,{style:{gap:0},children:[(0,f.jsx)(n.T,{size:x?15:13,weight:"semibold",colour:p?'#FFB3AA':u.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&c>=60?(0,f.jsx)(n.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,a.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(n.T,{size:x?14:12,weight:"semibold",colour:i?u.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,i)]})]})]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=function({rid:e,by:t,app:o,size:c="m"}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x='s'===c?17:20;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(h.counts[t.key]??0)-(b[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>p(!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)',...l.look.web({cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,l=b[t.key]??0,i=Math.max(0,o-l),d=i<=0,c=d||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,i)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(n.T,{size:x-2,children:t.icon}),(0,f.jsx)(n.T,{size:x,weight:"bold",colour:d?u.colours.red:c?u.colours.amber:u.colours.text,style:{lineHeight:x+4},children:(0,a.fmtStockCount)(e,t,i)}),l||d||c?(0,f.jsx)(n.T,{size:10,weight:"semibold",colour:d||c?'#FFB3AA':u.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),n=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]);const p=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function k(e){const t=(0,h.useBookings)(e),s=(0,h.useRestaurant)(e),o=(0,y.ymd)((0,h.useNow)(6e4));return(0,b.reservedOn)(t,o,(0,b.reservablesOf)(s))}function x(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:i,onOrder:c}){const h=(0,d.useShellfish)(e,o,l),[b,y]=(0,s.useState)({}),[k,j]=(0,s.useState)(null),w=x(e,h.items.find(e=>e.supplierId)?.supplierId),C=(s,o)=>{const l=h.itemOf(s);l&&y(i=>({...i,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,i[s]||0,o):Math.max(0,Math.min(99,(i[s]||0)+o))}))},S=(e,t=!1)=>{const s=h.itemOf(e);h.sell(e,t)&&j(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},L=Object.values(b).reduce((e,t)=>e+t,0);return(0,f.jsxs)(n.Sheet,{visible:!0,onClose:i,title:h.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:"shellfish-panel",children:[(0,f.jsx)(n.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:h.items.map(s=>{const o=h.counts[s.key]??0;return(0,f.jsxs)(r.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.isLow(s.key)?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface2},children:[(0,f.jsxs)(n.T,{center:!0,size:13,colour:u.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(n.T,{center:!0,size:48,weight:"bold",colour:h.isLow(s.key)?u.colours.amber:u.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,f.jsx)(n.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:()=>S(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(n.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>S(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(r.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(n.Button,{kind:"ghost",label:h.undoable?`\u21b6 Undo: ${(0,a.describe)(h.undoable,h.itemOf(h.undoable.kind))}`:'\u21b6 Nothing to undo',testID:"shellfish-undo",disabled:!h.undoable,onPress:()=>{const e=h.undoable;h.undoLast(),e&&j(`Undone: ${(0,a.describe)(e,h.itemOf(e.kind))}.`)}}),k?(0,f.jsx)(n.Banner,{kind:"success",title:k}):null,(0,f.jsxs)(r.default,{testID:"delivery-in",style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.goldTint},children:[(0,f.jsx)(n.T,{weight:"semibold",colour:u.colours.goldLight,children:"Delivery in"}),h.items.map(s=>(0,f.jsxs)(n.Row,{gap:10,children:[(0,f.jsxs)(n.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,onPress:()=>C(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(n.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,b[s.key]||0)}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>C(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(n.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>C(s.key,5)})]},s.key)),(0,f.jsx)(n.Button,{kind:"success",label:L?`Add to stock: ${h.items.filter(e=>b[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,b[t.key])} ${(1===b[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!L,onPress:()=>{h.items.forEach(e=>h.deliver(e.key,b[e.key]??0)),j('Delivery added to the count.'),y({})},style:{minHeight:54}})]}),c?(0,f.jsx)(n.Button,{kind:"secondary",label:w?`${w} order sheet \u203a`:'Order sheets \u203a',onPress:c}):null,(0,f.jsxs)(r.default,{style:{gap:2},children:[(0,f.jsx)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"RECENT"}),h.events.slice(0,6).map(e=>(0,f.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(n.T,{size:13,style:{flex:1},children:(0,a.describe)(e,h.itemOf(e.kind))}),(0,f.jsxs)(n.Muted,{children:[p(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(n.Row,{wrap:!0,gap:6,children:h.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(n.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(n.Muted,{children:"Not connected to the shared venue yet."})]})})]})}},938,[1025,30,1232,937,263,127,813,1028,1026,1027,821,819,828,818,24]);
+__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:s,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),A=(0,n.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const S=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(S)return(0,h.jsx)(j,{o:S,me:s,readOnly:k,compact:!0});const w={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:w,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:["1. Booked: ",x(l.allergyAck.by)," at ",b(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!s.trim(),onPress:()=>A(l.id,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,s=r(d[2]),t=(l=s)&&l.__esModule?l:{default:l},o=r(d[3]),i=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),x=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:s}){return(0,h.jsx)(t.default,{testID:s,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((s,i)=>{const n=!!e[s.id],c=l===s.id,f=n?u.colours.ok:c?u.colours.gold:u.colours.border;return(0,h.jsxs)(t.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',width:'100%'},children:[(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i?n||c?f:u.colours.border:'transparent'}}),(0,h.jsx)(t.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:f,backgroundColor:n?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(o.T,{size:12,weight:"bold",colour:n?'#0B0B0B':c?u.colours.gold:u.colours.muted,children:n?'\u2713':String(s.n)})}),(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i<4?n?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(o.T,{size:11,weight:c?'semibold':'regular',colour:n?u.colours.text:c?u.colours.gold:u.colours.muted,center:!0,children:s.label}),e[s.id]?(0,h.jsxs)(o.T,{size:10,colour:u.colours.muted,center:!0,numberOfLines:2,children:[x(e[s.id].by).split(' ')[0]," ",b(e[s.id].at)]}):null]},s.id)})})}function j({o:l,me:s,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),A=(0,n.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const S=(0,c.linkedBooking)(l,p),w=(0,c.orderChain)(l,S),I=(0,c.nextStep)(l,S),C=c.CHAIN_STEPS.filter(e=>w[e.id]).length,B=I?(0,c.stepInfo)(I):null,D='table'===I&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:I?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:I?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:I?'red':'ok',label:I?`${C} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:w,next:I,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>w[e.id]).map(e=>(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:w[e.id].by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",x(w[e.id].by)," at ",b(w[e.id].at)]})]},e.id)),B?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(o.T,{size:13,children:["Next: ",B.n,". ",B.label,". ",B.what,"."]}),j?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${B.label} on ${l.ref}`,disabled:!s.trim()||D,onPress:()=>A(l.id,I,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]}),D?(0,h.jsx)(o.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(o.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(o.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},939,[868,30,127,813,1021,872,940,821,953,24]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},940,[]);
+__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;te.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},942,[1116,952,1117,943,944,1119,2,872,1026,1094,918]);
+__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},943,[]);
+__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},944,[]);
+__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},945,[808,17]);
+__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_WAKE_PIN",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_WAKE_SALT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hashWakePin",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_WAKE",{enumerable:!0,get:function(){return o}}),e.newSalt=u,e.wakePinProblem=function(n){return/^\d{6,8}$/.test(n)?/^(\d)\1+$/.test(n)||'0123456789012'.includes(n)||'9876543210987'.includes(n)?'Pick a PIN that is harder to guess (not all the same digit or a run like 123456).':n===t?'Pick a new PIN, not the starting one.':null:'The wake PIN must be 6 to 8 digits.'},e.makeWakePin=function(n,t=u()){return{pinHash:a(n,t),pinSalt:t,pinLen:n.length,pinDefault:!1}},Object.defineProperty(e,"wakePinMatches",{enumerable:!0,get:function(){return l}}),e.fromOldPin=function(n){const i='string'==typeof n&&/^\d{4,8}$/.test(n)?n:t;if(i===t)return{...o};const l=u();return{pinHash:a(i,l),pinSalt:l,pinLen:i.length,pinDefault:!1}};var n=r(d[0]);const t='2580',i='cc-wake-default',a=(t,i)=>(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},946,[1153]);
+__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},947,[952]);
+__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 n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},948,[1311]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return w}}),_e.cancelWalkInWords=y,_e.cancelWalkInNow=$,_e.CancelWalkInButton=function({rid:e,b:l,onDone:t,small:s}){const[c,o]=(0,n.useState)(!1);return w(l)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${l.id}`,accessibilityLabel:`Cancel walk-in ${l.ref}, ${l.partySize} Covers`,onPress:()=>o(!0),style:s?{minHeight:44}:k}),c?(0,f.jsx)(h,{rid:e,b:l,onClose:()=>o(!1),onDone:t}):null]}):null},_e.CancelWalkInConfirm=h;var e,n=r(d[0]),l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),c=r(d[3]),o=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]);const k={minHeight:56},w=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status);function y(e){const n=(0,c.tablesOf)(e.table),l=(0,o.tablesWords)(n);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${n.length?` at ${l}`:''}, arrived ${e.time}? It comes off the Covers${n.length?` and ${l} ${n.length>1?'go':'goes'} back to Free`:''}.`}async function $(e,n){await s.repo.bookings.setStatus(n.id,'cancelled'),(0,c.tablesOf)(n.table).forEach(n=>c.useFloor.getState().setLive(e,n,{stage:void 0,dirty:!1}))}function h({rid:e,b:n,onClose:l,onDone:s}){const w=y(n);return(0,f.jsxs)(u.Sheet,{visible:!0,onClose:l,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,f.jsx)(t.default,{accessible:!0,accessibilityLabel:w,children:(0,f.jsx)(u.T,{size:18,colour:b.colours.text,children:w})}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${n.ref}`,style:[k,{flexGrow:1}],onPress:async()=>{await $(e,n),l(),s?.(`Walk-in ${n.ref} cancelled.${(0,c.tablesOf)(n.table).length?` ${(0,o.tablesWords)((0,c.tablesOf)(n.table))} free.`:''}`)}}),(0,f.jsx)(u.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${n.ref}`,onPress:l,style:k})]})]})}},949,[30,127,819,825,931,821,813,24]);
+__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),v=k?[...j,...A.filter(e=>!j.includes(e))]:j;return v.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),v.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},950,[808,30,127,813,819,1026,856,828,818,821,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},951,[30,127,13,821,813,24]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},952,[1126,1127]);
+__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return u}}),_e.specFor=E,_e.AvatarArt=$,_e.useStaffMember=v,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=v(i,t),y=f?.id??i,F=(0,n.useAvatars)(i=>y?i.photos[y]:void 0),u=(0,o.useSetup)(i=>y?i.looks[y]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,h.jsx)(r.default,{testID:y?`avatar-${y}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,l.soutersSurface)('#111')},children:F?(0,h.jsx)(e.default,{source:{uri:F.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,h.jsx)($,{spec:null!=u?E(`${y}#look${u}`):E(y,f?.name??t),size:s-(c?2*Math.max(1,s/22):0)})})};var l=_r(d[0]);_r(d[1]);var e=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const y=Object.fromEntries(f.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],u=['#E9B949','#CFA45F'],j=F,C=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],p=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],A=['quiff','flip','crop','beehive','bob','curls'],b=i=>{let l=7;for(const e of i)l=31*l+e.charCodeAt(0)>>>0;return l};function E(i,l){if(i&&y[i])return y[i];const e=b(i||l||'crew');return{bg:j[e%6],ring:u[e%2],skin:C[(e>>3)%6],hair:p[(e>>6)%5],hairStyle:A[(e>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(e>>12)%3]}}const k=(i,l,e)=>`M${i} ${l-e} Q${i+.18*e} ${l-.18*e} ${i+e} ${l} Q${i+.18*e} ${l+.18*e} ${i} ${l+e} Q${i-.18*e} ${l+.18*e} ${i-e} ${l} Q${i-.18*e} ${l-.18*e} ${i} ${l-e}Z`;function $({spec:i,size:l=40}){const e=i,r='#1B1B1B',c='flip'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:e.hair}):'bob'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:e.hair}):'beehive'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:e.hair}),(0,h.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:e.hair})]}):'curls'===e.hairStyle?(0,h.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,l],r)=>(0,h.jsx)(t.Circle,{cx:i,cy:l,r:7,fill:e.hair},r))}):null,n='quiff'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:e.hair}),(0,h.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:e.hair})]}):'crop'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:e.hair}):'curls'===e.hairStyle?null:(0,h.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:e.hair});return(0,h.jsxs)(s.default,{width:l,height:l,viewBox:"0 0 100 100",children:[(0,h.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:e.bg}),(0,h.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,h.jsx)(t.Path,{d:k(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,h.jsx)(t.Path,{d:k(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,h.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,h.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,h.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:e.suit}),(0,h.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:e.ring,fillOpacity:.35}),(0,h.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:e.skin}),c,(0,h.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:e.skin}),n,e.specs?(0,h.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,h.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,h.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:e.ring}),(0,h.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:e.ring}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:e.bg}),(0,h.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,h.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==e.antenna?(0,h.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:e.ring,strokeWidth:2}):null,'ball'===e.antenna?(0,h.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:e.ring}):'star'===e.antenna?(0,h.jsx)(t.Path,{d:k(50,6.5,4.5),fill:e.ring}):null]})}const O=i=>(i??'').replace(' (example)','').trim().toLowerCase();function v(i,l){const e=(0,c.useOwner)(i=>i.staff);return i?e.find(l=>l.id===i):l?e.find(i=>O(i.name)===O(l)):void 0}},953,[868,30,196,127,948,856,1201,1202,821,14,24]);
+__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},954,[]);
+__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},955,[952,863,820,1396,2,1397]);
+__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},956,[1116,952,1117,1104,958,14,1033,1205]);
+__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t)),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},957,[1116,952,1117,1104,1108,1033]);
+__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reeds order',message:'Order reeds',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},958,[]);
+__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=l,e.useShiftReminders=function({rid:c,staffId:k,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const I=(0,t.useRef)(h);I.current=h;const v=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=u(),{att:h,shift:S,on:v}=l(k,t),w=s.useReminders.getState();if(!v||!k)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const R=(0,s.rulesOf)(c),$=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:$,shiftStart:S?m(S.date,S.start):void 0,shiftEnd:S?m(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?m(S.date,S.breakAt):void 0,hadBreak:p,rules:R},w.snooze[y]??0);if(M){const r=$??(S?m(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${$?'Clocked in':'Shift started'} at ${f(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(u()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:k,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>s.useReminders.getState().setSnooze(y,u()+6e4*R.snoozeMins)}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===k),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:f}=(0,o.reminderDue)(n,t),m=w.done.find(t=>t.reminderId===n.id&&t.forDate===f),l=`rem:${n.id}:${f}`;!d||m||(w.snooze[l]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:f,at:new Date(u()).toISOString(),staffRef:k,staffName:I.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(l,u()+6e4*R.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,k,v,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]);const u=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},f=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),m=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function l(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=s.shifts.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&m(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),u=!a&&!!c&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=m(c.date,c.start));return{att:a,shift:c,on:!!a||!!c&&!u}}},959,[30,1103,856,957,1108,947,1118,872]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},960,[]);
+__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},988,[6,954]);
+__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)(s.default,{testID:"who-bar",accessible:!0,accessibilityLabel:l,style:{paddingVertical:4},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:t.colours.gold,children:l})})},r(d[0]);var e,l=r(d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),t=r(d[3]),c=r(d[4]),o=r(d[5])},989,[30,127,927,821,813,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},990,[30]);
+__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return y}}),_e.runBackLayer=function(){const e=y.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(t,n,s=!0){const o=(0,e.useRef)(n);o.current=n,(0,e.useEffect)(()=>{if(!t)return;const e=++w,n=(0,l.currentScrollY)(),c=(0,l.screenGeneration)();return y.setState(t=>({layers:[...t.layers,{id:e,fn:()=>o.current(),own:s}]})),()=>{y.setState(t=>({layers:t.layers.filter(t=>t.id!==e)})),(0,l.screenGeneration)()===c&&(0,l.restoreScroll)(n)}},[t,s])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return h}}),_e.BackButton=function({onPress:e,testID:t="screen-back",label:n="Back"}){return(0,f.jsx)(s.default,{testID:t,accessibilityRole:"button",accessibilityLabel:n,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,f.jsxs)(u.T,{size:18,weight:"semibold",colour:c.colours.gold,children:["\u2039 ",n]})})},_e.useWebBack=function(t){const n=(0,e.useRef)(t);n.current=t,(0,e.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),s=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),c=r(d[4]),u=r(d[5]),l=r(d[6]),f=r(d[7]);const y=(0,o.create)(()=>({layers:[]}));let w=0;const h=()=>y(e=>e.layers.some(e=>e.own))},991,[30,122,263,952,821,813,990,24]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=function({rid:e,by:n,canMark:a=!0}){const f=(0,r.useSoldOut)(e=>e.entries),b=(0,i.useStore)(e=>e.clock),j=(0,i.useStore)(e=>e.menu),w=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[S,I]=(0,s.useState)(''),$=(0,h.nowFrom)(b),C=(0,d.activeSoldOut)(f,e,$),D=new Set(C.map(e=>e.itemId)),M=(0,d.soldOutSettingsOf)(w?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),L=f.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),v=(0,s.useMemo)(()=>j.filter(t=>t.restaurantId===e&&!t.hidden&&!D.has(t.id)&&(!S.trim()||t.name.toLowerCase().includes(S.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[j,e,S,C.length]),B=(t,s)=>{const o=f.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));j.some(e=>e.id===t)?(0,r.setSoldOut)(t,!1,n):r.useSoldOut.getState().back(e,t,n),x(`Back on: ${s}${o?' (kept on until the count changes)':''}`)};return(0,y.jsxs)(o.default,{testID:"soldout-list",style:{gap:10},children:[(0,y.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,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,y.jsx)(l.T,{size:13,colour:C.length?m.colours.amber:m.colours.muted,children:C.length?(0,d.soldOutCount)(C.length):'Nothing sold out'})]}),C.length?C.map(e=>(0,y.jsxs)(o.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,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,y.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,y.jsxs)(l.Muted,{children:["Since ",k(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 ${k(e.clearAfter)}`:''}`]})]}),a?(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Back on: ${e.name}`,onPress:()=>B(e.itemId,e.name)}):null]},e.itemId)):(0,y.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),L.length?(0,y.jsx)(o.default,{testID:"soldout-kept",children:(0,y.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",L.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,y.jsxs)(l.Muted,{children:["Clears by itself: ",d.SOLD_OUT_CLEAR_LABEL[M.clear].toLowerCase(),". ",M.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),T.items.length?(0,y.jsx)(p,{rid:e,by:n,canEdit:a,auto:M.auto,view:T}):null,a?(0,y.jsxs)(l.Card,{children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,y.jsx)(t.TextInput,{testID:"soldout-search",value:S,onChangeText:I,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}}),v.slice(0,60).map(e=>(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{children:e.name}),(0,y.jsx)(l.Muted,{children:e.section})]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${e.id}`,accessibilityLabel:`Mark sold out: ${e.name}`,onPress:()=>{return t=e.id,s=e.name,(0,r.setSoldOut)(t,!0,n),void x(`Sold out: ${s}`);var t,s}})]},e.id)),v.length?null:(0,y.jsx)(l.Muted,{children:S?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),a=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),y=_r(_d[12]);const k=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'])a.useOwner.getState().sys(s,e,t)};const f={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},b=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function p({rid:e,by:t,canEdit:n,auto:i,view:r}){const[a,d]=(0,s.useState)(!1),[h,k]=(0,s.useState)(null),[x,p]=(0,s.useState)([]),j=r.dishes.filter(t=>t.uses.length||'none'===t.source&&r.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(a?r.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=r.items.map(e=>`${e.name.toLowerCase()} ${b(r.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>p(n=>n.map(n=>n.key===e?{...n,qty:Math.max(0,Math.min(20,n.qty+s*('half'===t.unit?.5:1)))}:n)),$=(s,n)=>{u.useSoldOutLinks.getState().setLink(e,s,n,t),k(null)};return(0,y.jsx)(o.default,{testID:"soldout-links",children:(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,y.jsx)(o.default,{testID:"soldout-links-counts",children:(0,y.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,y.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,y.jsxs)(o.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{weight:"semibold",children:e.name}),(0,y.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,r.items)}`:'Not linked to the counts',f[e.source]?` \xb7 ${f[e.source]}`:'']})]}),n&&h!==e.id?(0,y.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,k(t),void p(r.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,y.jsxs)(o.default,{style:{gap:6},children:[r.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,y.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,y.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,y.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,y.jsx)(o.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,y.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:b(s)})}),(0,y.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,y.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),r.items)}.`:'Not linked: never marked from the counts.']}),(0,y.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,y.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,y.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,r.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>k(null)})]}),(0,y.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,y.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:a?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>d(!a)})]})})}},992,[877,30,127,813,819,918,856,944,942,943,872,821,24]);
+__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.77'},993,[]);
+__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],i=(0,d.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=b();return(0,r.progress)(t,i,s,l,o)},_e.DailyTasksEditor=T,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:c}){const u=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],h=(0,d.useDailyTasks)(e=>e.ticks),{ymd:y,dow:k}=b(),p=(0,r.tasksFor)(u,k);if(!s||!p.length)return null;const T=(0,r.progress)(u,h,s,y,k);return(0,x.jsx)(l.default,{testID:"my-tasks-today",children:(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{weight:"semibold",colour:n.colours.gold,children:"My tasks today"}),(0,x.jsx)(o.Badge,{kind:T.done===T.total?'gold':'neutral',label:`${T.done} of ${T.total}`})]}),c?null:(0,x.jsx)(o.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(r=>{const u=h.find(t=>t.id===(0,d.tickId)(e,s,r.id,y));return(0,x.jsxs)(i.default,{testID:`my-task-${r.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!c,onPress:()=>d.useDailyTasks.getState().toggleTick(e,s,r.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:c?1:.6},children:[(0,x.jsx)(l.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,x.jsx)(o.T,{colour:n.colours.gold,children:"\u2713"}):null}),(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{style:{textDecorationLine:u?'line-through':'none'},children:r.text}),u?(0,x.jsxs)(o.Muted,{size:12,children:["Done at ",f(u.at)]}):null]})]},r.id)}),(0,x.jsx)(o.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const i=(0,d.useDailyTasks)(s=>s.library[e]?.items)??[],[c,u]=(0,t.useState)(''),[y,p]=(0,t.useState)({}),f=d.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,x.jsxs)(l.default,{style:{gap:8},testID:"task-library",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),i.map((e,t)=>(0,x.jsxs)(o.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:y[e.id]??e.text,onChangeText:s=>p(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,r.cleanTaskText)(y[e.id]??'');s&&s!==e.text&&b(i.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...k,flex:1,minWidth:0}}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===t,onPress:()=>b((0,r.move)(i,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:t===i.length-1,onPress:()=>b((0,r.move)(i,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(i.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:c,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:n.colours.muted,style:{...k,flex:1}}),(0,x.jsx)(o.Button,{small:!0,label:"Add",disabled:!(0,r.cleanTaskText)(c),onPress:()=>{b([...i,{id:(0,h.uuid)(),text:(0,r.cleanTaskText)(c)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,y.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,r.canEditTasks)(s,e));return(0,x.jsxs)(l.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,x.jsx)(o.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,x.jsx)(o.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,x.jsxs)(o.Card,{children:[(0,x.jsx)(o.T,{weight:"semibold",children:(0,y.staffLabel)(t).replace(' (example)','')}),(0,x.jsxs)(o.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,x.jsx)(T,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=e(_r(_d[2])),l=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]);const k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:n.colours.hairline,backgroundColor:n.colours.surface2,color:n.colours.text,paddingHorizontal:10,fontSize:15},p=[1,2,3,4,5,6,0],f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),b=(e=Date.now())=>{const s=(0,c.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function T({rid:e,person:c,actor:h}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const y=(0,d.useDailyTasks)(s=>s.people[(0,d.personKey)(e,c.id)]?.tasks)??[],T=((0,d.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),j=(0,d.useDailyTasks)(e=>e.ticks),[w,D]=(0,t.useState)(!1),[v,S]=(0,t.useState)(''),[C,$]=(0,t.useState)(null),I=d.useDailyTasks.getState(),M=(0,r.canEditTasks)(h,c),{ymd:P,dow:R}=b(),L=(0,r.progress)(y,j,c.id,P,R),B=s=>I.setTasks(e,c.id,s),z=e=>{const s=y;B(y.filter(s=>s.id!==e.id)),(0,u.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,x.jsxs)(l.default,{testID:`tasks-${c.id}`,style:{gap:6},children:[(0,x.jsx)(i.default,{accessibilityRole:"button",testID:`tasks-open-${c.id}`,onPress:()=>D(!w),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(o.T,{weight:"semibold",colour:n.colours.gold,children:["Daily tasks ",w?'\u25b4':'\u25be']}),(0,x.jsx)(o.Muted,{size:12,children:y.length?`${L.done} of ${L.total} done today`:'None yet'})]})}),w?(0,x.jsxs)(l.default,{style:{gap:6},children:[y.map((s,t)=>{const i=j.find(t=>t.id===(0,d.tickId)(e,c.id,s.id,P));return(0,x.jsxs)(l.default,{testID:`task-row-${t}`,style:{borderTopWidth:1,borderColor:n.colours.hairline,paddingTop:6,gap:4},children:[(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsxs)(o.T,{style:{flex:1},colour:i?n.colours.gold:n.colours.text,children:[i?'\u2713 ':'',s.text]}),M?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===t,onPress:()=>B((0,r.move)(y,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:t===y.length-1,onPress:()=>B((0,r.move)(y,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>$(C===s.id?null:s.id)}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",testID:`task-remove-${t}`,label:"\u2715",accessibilityLabel:`Remove ${s.text}`,onPress:()=>z(s)})]}):null]}),(0,x.jsxs)(o.Muted,{size:12,children:[s.days?.length?s.days.map(e=>r.TASK_DAY_NAMES[e]).join(', '):'Every day',i?` \xb7 ticked by ${i.byName.split(' ')[0]} at ${f(i.at)}`:'']}),C===s.id?(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:p.map(e=>{const t=!!s.days?.includes(e);return(0,x.jsx)(o.Chip,{label:r.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(y.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),M?(0,x.jsxs)(l.default,{style:{gap:6},children:[(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:T.filter(e=>!y.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,x.jsx)(o.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>I.addTask(e,c.id,s.text,s.id)},s.id))}),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${c.id}`,value:v,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:n.colours.muted,style:{...k,flex:1},onSubmitEditing:()=>{(0,r.cleanTaskText)(v)&&(I.addTask(e,c.id,v),S(''))}}),(0,x.jsx)(o.Button,{small:!0,testID:`task-add-${c.id}`,label:"Add",disabled:!(0,r.cleanTaskText)(v),onPress:()=>{I.addTask(e,c.id,v),S('')}})]})]}):(0,x.jsx)(o.Muted,{size:12,children:'staff'===h?.role?'You can\u2019t change this list.':''})]}):null]})}},994,[877,30,263,127,813,821,1106,1107,1108,947,1033,856,24]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=S,_e.ReviewSheet=I,_e.Bars=P,_e.CashCharts=M,_e.CashUpScreen=function({rid:e,today:t,canEdit:s,who:l,chartsOnly:n}){const r=(0,p.useCashSettings)(e),h=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),m=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[f,x]=(0,a.useState)(null),[D,P]=(0,a.useState)(null),$=(0,w.useLockedFor)(e),[B,R]=(0,a.useState)(!1),[L,A]=(0,a.useState)(null),z=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7)));if($(e,l))return void P((0,w.lockedMessage)(e,l));const n=s?await(0,k.pickPhotos)({source:s}):[];if(s&&!n.length)return void P('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const i='cashup'===e?r.cashFields:r.salesFields;let d,u={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),P('Reading the photo\u2026'),d=await Promise.all(n.map((t,s)=>(0,k.uploadPhoto)(e,l,t,s))),u=await(0,j.readSheet)(e,d.filter(e=>!!e),i),R(!1),P(null));const c=o&&'cashup'===e?h.find(e=>e.date===l)?.vals:void 0;x({kind:e,key:l,photos:n,vals:c?{...u.vals,...c}:u.vals,categories:u.categories??[],unread:(0,y.missing)(i,u.vals),note:u.note,reader:o?'edit':u.reader,uploaded:d,only:o})},E=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':v((0,y.addDaysYmd)(t,-e)),value:(0,y.addDaysYmd)(t,-e)})),N=[0,1,2].map(e=>{const s=(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${v(s)}`,value:s}});return(0,C.jsxs)(d.default,{testID:"cashup-screen",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),D?(0,C.jsx)(u.Banner,{kind:"info",children:D}):null,(0,C.jsx)(U,{rid:e,today:t,manage:s,who:l}),s&&!n?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsx)(u.T,{weight:"semibold",children:"End of night cash up"}),(0,C.jsx)(i.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:B,onPress:()=>{z('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?c.colours.goldLight:c.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:B?.5:1}),children:(0,C.jsx)(u.T,{size:20,weight:"semibold",colour:c.colours.onGold,children:B?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{z('cashup','gallery')}}),(0,C.jsx)(u.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('cashup',null)}}),(0,C.jsx)(u.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,b.pickSpreadsheet)();e&&('error'in e?P(e.error):A(e))}}),(0,C.jsx)(u.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{z('cashup',null,t,y.TAKINGS_KEYS)}})]}),(0,C.jsx)(u.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{z('sales','camera')}}),(0,C.jsx)(u.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{z('sales','gallery')}}),(0,C.jsx)(u.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('sales',null)}})]}),(0,C.jsx)(u.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,(0,C.jsx)(M,{rid:e,today:t}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Recent cash ups"}),h.length?h.slice(0,10).map(e=>(0,C.jsxs)(d.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{weight:"semibold",children:v(e.date)}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T((0,y.takings)(e.vals))})]}),(0,C.jsx)(u.Muted,{children:r.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,C.jsxs)(u.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),s&&!$('cashup',e.date)?(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>x({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,y.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>x({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:y.TAKINGS_KEYS})})]}):null,s?(0,C.jsx)(w.CashLockControls,{kind:"cashup",item:e,label:v(e.date)}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly sales reports"}),m.length?m.slice(0,8).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["w/c ",v(e.weekStart)]}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,C.jsx)(u.Muted,{children:r.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,C.jsx)(w.CashLockControls,{kind:"sales",item:e,label:`w/c ${v(e.weekStart)}`}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),L?(0,C.jsx)(b.SpreadsheetImport,{rid:e,file:L,who:l,locked:e=>$('cashup',e),onClose:()=>A(null),onSaved:e=>{P(e),A(null)}}):null,f?(0,C.jsx)(I,{draft:f,fields:'cashup'===f.kind?r.cashFields:r.salesFields,onClose:()=>x(null),onConfirm:async(t,s)=>{if(!f)return;if($(f.kind,f.key))return P((0,w.lockedMessage)(f.kind,f.key)),void x(null);const a=f.uploaded&&f.uploaded.length===f.photos.length?f.uploaded:await Promise.all(f.photos.map((e,t)=>(0,k.uploadPhoto)(f.kind,f.key,e,t))),n=f.photos.map((e,t)=>a[t]??e),r=(new Date).toISOString();if('cashup'===f.kind){const s=h.find(e=>e.date===f.key),a=f.only&&s?{...s.vals,...t}:t;p.useCashUp.getState().saveCashUp({rid:e,date:f.key,vals:a,photos:f.only&&s?s.photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader});const i=(0,y.combinedTips)(a),d=S(a);P(`Cash up for ${v(f.key)} saved${d?`: ${d}`:''}${null==i||f.only?'':`. Today\u2019s tips (${T(i)}) are now showing in the staff apps`}.`);try{o.default.announceForAccessibility?.(`Saved. ${d}`)}catch{}}else p.useCashUp.getState().saveSales({rid:e,weekStart:f.key,vals:t,categories:s,photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader}),P(`Weekly sales for the week of ${v(f.key)} saved.`);a.some(e=>null==e)&&f.photos.length&&P(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),x(null)},keyLabel:'cashup'===f.kind?'Day':'Week starting',keyChoices:'cashup'===f.kind?E:N,onKey:e=>x({...f,key:e})},`${f.kind}-${f.photos.length}`):null]})},_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,p.useTipsShow)(e),o=(0,p.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,y.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=R(o?.total??0);return a.showToday&&o?(0,C.jsx)(u.Card,{highlight:c.colours.gold,children:(0,C.jsxs)(d.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(o.total/25)}),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,C.jsx)(u.T,{size:s?40:32,weight:"bold",colour:c.colours.goldLight,children:T(l)}),(0,C.jsxs)(u.Muted,{children:["Cash + card tips for the whole team \xb7 ",v(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=U,_e.useTipsPosted=function(e,t,s=!0){const o=(0,p.useCashUp)(e=>e.tips),l=(0,p.useTipsShow)(e);(0,a.useEffect)(()=>{if(!s||!l.showToday)return;const a=o.filter(s=>s.rid===e&&s.date>=(0,y.addDaysYmd)(t,-1)&&s.date<=t).sort((e,t)=>t.date.localeCompare(e.date))[0];if(!a)return;const n=`${e}:${a.date}`;p.useCashUp.getState().seen[n]!==a.total&&(p.useCashUp.getState().markSeen(n,a.total),(0,x.notify)({id:`tips-${n}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${a.date===t?'Today\u2019s':'Last night\u2019s'} tips: ${T(a.total)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))},[e,t,o,l.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=(0,p.useCashSettings)(e),a=(t,s)=>p.useCashUp.getState().setFields(e,t,s),o=(e,o)=>(0,C.jsxs)(d.default,{style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",children:o}),t[e].map((o,l)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{testID:`cf-${e}-${o.key}`,value:o.label,onChangeText:s=>a(e,t[e].map((e,t)=>t===l?{...e,label:s.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:c.colours.text,paddingHorizontal:8}}),(0,C.jsx)(u.Muted,{children:'money'===o.kind?'\xa3':'number'===o.kind?'#':'text'}),o.fixed?(0,C.jsx)(u.Muted,{children:"needed"}):(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:`Remove ${o.label}`,onPress:()=>a(e,t[e].filter((e,t)=>t!==l))})]},o.key)),(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>a(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>a(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,C.jsxs)(d.default,{testID:"cashup-settings",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),o('cashFields','Cash up sheet'),o('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,p.useTipsShow)(e);return(0,C.jsxs)(d.default,{testID:"tips-settings",style:{gap:8},children:[(0,C.jsx)(u.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,C.jsx)(u.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>p.useCashUp.getState().setShow(e,{showToday:t})}),(0,C.jsx)(u.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>p.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),j=_r(_d[18]),b=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]);const T=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function S(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,y.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${T(t)}`).join(', ')}function D({p:e,h:s}){const[o,l]=(0,a.useState)(e.startsWith('data:')?e:null);return(0,a.useEffect)(()=>{o||(0,k.photoUrl)(e).then(l)},[e]),o?(0,C.jsx)(r.default,{source:{uri:o},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,C.jsx)(d.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(u.Muted,{children:"Photo"})})}function I({draft:e,fields:t,onClose:o,onConfirm:l,keyLabel:n,onKey:r,keyChoices:i}){const{width:p,height:m}=(0,h.default)(),f=p>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[x,k]=(0,a.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,y.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,b]=(0,a.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[w,T]=(0,a.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?x[e.key]?.trim()||null:(0,y.parseAmount)(x[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(x[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),I=(0,y.missing)(t,v),P=j.map(e=>({name:e.name.trim(),amount:(0,y.parseAmount)(e.amount)})).filter(e=>e.name),M=P.some(e=>null==e.amount),$=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?c.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:c.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,C.jsx)(d.default,{testID:"review-photos",style:{gap:8,flex:f?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,C.jsx)(D,{p:t,h:f?Math.max(300,.62*m/Math.min(2,e.photos.length)):260},s)):(0,C.jsx)(u.Muted,{children:"No photo: typed by hand."})}),R=(0,C.jsxs)(d.default,{testID:"review-fields",style:{gap:8,flex:f?1:void 0},children:[(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Muted,{children:n}),i.map(t=>(0,C.jsx)(u.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>r(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(x[e.key]??'').trim()||S.includes(e.key);return(0,C.jsxs)(d.default,{style:{gap:3},children:[(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,C.jsx)(u.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,C.jsx)(s.TextInput,{testID:`review-${e.key}`,value:x[e.key]??'',onChangeText:t=>k(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:$(t)})]},e.key)}),'sales'===e.kind?(0,C.jsxs)(d.default,{testID:"review-categories",style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{value:e.name,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[$(!1),{flex:2}]}),(0,C.jsx)(s.TextInput,{value:e.amount,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[$(!e.amount.trim()||null==(0,y.parseAmount)(e.amount)),{flex:1}]}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:"Remove category",onPress:()=>b(e=>e.filter((e,s)=>s!==t))})]},t)),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>b(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:o,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,C.jsx)(u.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,C.jsx)(u.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,f?(0,C.jsxs)(d.default,{style:{flexDirection:'row',gap:14},children:[B,R]}):(0,C.jsxs)(C.Fragment,{children:[B,R]}),I.length?(0,C.jsxs)(u.Muted,{children:[I.length," figure",1===I.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,C.jsxs)(u.Row,{gap:8,children:[(0,C.jsx)(u.Button,{testID:"review-confirm",label:w?'Saving\u2026':'Confirm and save',disabled:w||!!S.length||M||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await l(v,P.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,C.jsx)(u.Button,{kind:"secondary",label:"Cancel",onPress:o})]})]})}function P({data:e,height:t=140,testID:s,fmt:a=T}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,C.jsxs)(d.default,{testID:s,style:{gap:4},children:[(0,C.jsx)(d.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,C.jsxs)(d.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,children:a(e.value).replace('.00','')}):null,(0,C.jsx)(d.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?c.colours.goldLight:c.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,C.jsx)(d.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function M({rid:e,today:s}){const a=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,y.dailySeries)(a,s,14),n=(0,y.dailySeries)(a,s,14,y.combinedTips),r=(0,y.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,y.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:v(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),h=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],m=h?(0,y.weekCompare)(o,h.weekStart):null,f=h?.categories??[],x=Math.max(1,...f.map(e=>e.amount)),k=h?(0,y.weekCompare)(o,h.weekStart,'covers'):null;return(0,C.jsxs)(d.default,{testID:"cash-charts",style:{gap:12},children:[(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,C.jsx)(P,{testID:"chart-daily",data:l.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Cash + card tips, team total."}),(0,C.jsx)(P,{testID:"chart-tips",height:100,data:n.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly net sales"}),m&&null!=m.now?(0,C.jsx)(d.default,{testID:"week-compare",children:(0,C.jsxs)(u.T,{size:15,children:["Week of ",v(h.weekStart),": ",T(m.now),null!=m.prev?` \xb7 week before ${T(m.prev)}`:'',null!=m.change?` \xb7 ${m.change>=0?'\u25b2':'\u25bc'} ${Math.abs(m.change)}%`:'']})}):(0,C.jsx)(u.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,C.jsxs)(u.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,C.jsx)(P,{testID:"chart-weekly",data:i})]}),f.length?(0,C.jsxs)(u.Card,{children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["By category, week of ",v(h.weekStart)]}),(0,C.jsx)(d.default,{testID:"chart-categories",style:{gap:6},children:f.map(e=>(0,C.jsxs)(d.default,{style:{gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{size:14,children:e.name}),(0,C.jsx)(u.T,{size:14,colour:c.colours.goldLight,children:T(e.amount)})]}),(0,C.jsx)(d.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,C.jsx)(d.default,{style:{width:e.amount/x*100+"%",height:10,borderRadius:5,backgroundColor:c.colours.gold}})})]},e.name))})]}):null]})}function $({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,C.jsx)(d.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,C.jsx)(B,{delay:50*t},t))})}function B({delay:e}){const t=(0,a.useRef)(new l.default.Value(1)).current;return(0,a.useEffect)(()=>{l.default.timing(t,{toValue:0,duration:420,delay:e,easing:n.default.out(n.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,C.jsx)(l.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,C.jsx)(d.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:c.colours.gold,borderWidth:1,borderColor:c.colours.goldLight}})})}function R(e){const[t,s]=(0,a.useState)(e),o=(0,a.useRef)(e);return(0,a.useEffect)(()=>{const t=o.current,a=e;if(t===a)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(a-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),o.current=a)},40);return()=>clearInterval(n)},[e]),t}function U({rid:e,today:t,manage:s,who:o,big:l}){const n=(0,p.useTipsShow)(e),r=(0,p.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,p.useCashUp)(e=>e.pot).filter(t=>t.rid===e),h=(0,f.useVenuePay)(e).pay,x=(0,m.tipsPeriod)(h,t),k=(0,a.useMemo)(()=>(0,y.tipsPot)(r,i,x.start,t),[r,i,x.start,t]),j=R(k.total),[b,w]=(0,a.useState)(null);return n.showPot||s?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsxs)(d.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(k.total/100),testID:"tips-pot-coins"},k.total),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,C.jsx)(u.T,{size:l?40:32,weight:"bold",colour:c.colours.goldLight,children:T(j)}),(0,C.jsxs)(u.Muted,{children:["Tips held for the team since ",v(k.from),x.payday?` \xb7 next tip payday ${v(x.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,C.jsxs)(u.T,{children:["Pay out ",T(k.total)," (tips from ",v(k.from)," to ",v(t),")?"]}),(0,C.jsx)(u.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,C.jsx)(u.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:k.total,by:o?.name??'Manager'}),w(null)}})]}):null,'correct'===b?(0,C.jsx)(L,{rid:e,today:t,who:o,onClose:()=>w(null)}):null,'history'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[k.history.length||i.some(e=>'correction'===e.kind)?null:(0,C.jsx)(u.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:4},children:[(0,C.jsx)(u.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${T(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${T(Math.abs(e.amount))} for ${v(e.forDate)}`}),(0,C.jsxs)(u.Muted,{children:['payout'===e.kind?`Tips to ${v(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function L({rid:e,today:o,who:l,onClose:n}){const[r,i]=(0,a.useState)(o),[d,h]=(0,a.useState)(''),[m,f]=(0,a.useState)(''),x=(0,y.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:c.colours.text,paddingHorizontal:10,fontSize:16};return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,C.jsx)(u.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,y.addDaysYmd)(o,-e);return(0,C.jsx)(u.Chip,{label:0===e?'Today':v(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-reason",value:m,onChangeText:f,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,C.jsx)(u.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==x||0===x||!m.trim(),onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:x,reason:m.trim(),by:l?.name??'Manager'}),n()}})]})}},995,[868,877,30,118,120,224,196,263,127,287,813,821,1093,1109,1110,1111,947,1281,1285,1286,1289,24]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1})),n=()=>!0===t.getState().mine},996,[952]);
+__d(function(g,_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,"fmtDate",{enumerable:!0,get:function(){return m}}),_e.SignOffLine=b,_e.CardView=w,_e.CardEditor=I,_e.RecipeCards=function({rid:e,actor:n,mode:d}){const f=(0,o.useRecipeCards)(e),[j,b]=(0,t.useState)(''),[C,k]=(0,t.useState)([]),[D,v]=(0,t.useState)('free-from'),[T,S]=(0,t.useState)('all'),[B,$]=(0,t.useState)(null),[P,R]=(0,t.useState)(null),L='edit'===d&&(0,h.canEditCards)(n.role),A=L?f:f.filter(e=>!!e.signOff),M=(0,t.useMemo)(()=>{const e='all'===T?A:A.filter(e=>(0,h.cardState)(e)===T);return(0,h.filterCards)(e,j,C,D).slice().sort((e,s)=>e.section.localeCompare(s.section)||e.dish.localeCompare(s.dish))},[A,j,C,D,T]),E=f.filter(e=>!e.signOff).length,N=B?f.find(e=>e.id===B):void 0,O=P&&'new'!==P?f.find(e=>e.id===P)??null:null,H=e=>k(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e]);return(0,p.jsxs)(l.default,{testID:"recipe-cards",style:{gap:12},children:['read'===d?(0,p.jsx)(a.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(n.role)?'You can add, edit and sign off cards. A card only goes live once you sign it off; any edit sets it back to Awaiting sign-off.':'You can add and edit cards. The head chef signs them off before they go live; any edit sets a card back to Awaiting sign-off.'}),f.some(e=>'example'===e.origin)?(0,p.jsx)(a.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,L?(0,p.jsx)(a.Button,{testID:"new-card",label:"New recipe card",onPress:()=>R('new')}):null,(0,p.jsx)(s.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:j,onChangeText:b,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:a.styles.input}),(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.muted,children:"Allergens:"}),(0,p.jsx)(a.Chip,{label:"Free from",selected:'free-from'===D,onPress:()=>v('free-from')}),(0,p.jsx)(a.Chip,{label:"Contains",selected:'contains'===D,onPress:()=>v('contains')}),C.length?(0,p.jsx)(a.Chip,{label:"Clear",onPress:()=>k([])}):null]}),(0,p.jsx)(a.Row,{gap:6,wrap:!0,children:c.ALLERGENS.map(e=>(0,p.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:C.includes(e.id)},onPress:()=>H(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:C.includes(e.id)?r.colours.gold:r.colours.border,backgroundColor:C.includes(e.id)?r.colours.gold:'transparent'},children:(0,p.jsx)(a.T,{size:13,colour:C.includes(e.id)?r.colours.onGold:r.colours.text,children:e.short})},e.id))}),L?(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.Chip,{label:`All (${f.length})`,selected:'all'===T,onPress:()=>S('all')}),(0,p.jsx)(a.Chip,{label:`Awaiting sign-off (${E})`,selected:'awaiting'===T,onPress:()=>S('awaiting')}),(0,p.jsx)(a.Chip,{label:`Signed off (${f.length-E})`,selected:'signed-off'===T,onPress:()=>S('signed-off')})]}):null,(0,p.jsx)(l.default,{testID:"card-count",children:(0,p.jsxs)(a.Muted,{children:[M.length," ",1===M.length?'card':'cards',C.length?` ${'free-from'===D?'free from':'containing'} ${C.map(c.allergenLabel).join('free-from'===D?' and ':' or ')}`:'']})}),M.map(e=>(0,p.jsx)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:`${e.dish}, ${e.signOff?'signed off':'awaiting sign-off'}`,onPress:()=>$(e.id),children:(0,p.jsx)(a.Card,{highlight:!e.signOff&&L?r.colours.amber:void 0,children:(0,p.jsxs)(a.Row,{gap:12,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:84},children:(0,p.jsx)(y,{card:e,height:64})}),(0,p.jsxs)(l.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(a.T,{weight:"semibold",children:e.dish}),(0,p.jsxs)(a.Muted,{children:[e.section," \xb7 ",x(e.price),'example'===e.origin?` \xb7 ${u.EXAMPLE_TAG}`:'']}),(0,p.jsxs)(a.Row,{gap:4,wrap:!0,children:[e.signOff?(0,p.jsx)(a.Badge,{label:`\u2713 ${m(e.signOff.at)}`,kind:"ok"}):(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),c.ALLERGENS.filter(s=>e.allergens[s.id]).map(s=>(0,p.jsx)(a.Badge,{label:'may'===e.allergens[s.id]?`${s.short}?`:s.short,kind:'may'===e.allergens[s.id]?'amber':'red'},s.id))]})]})]})})},e.id)),M.length?null:(0,p.jsx)(a.Muted,{children:"No cards match."}),(0,p.jsx)(a.Sheet,{visible:!!N&&!P,onClose:()=>$(null),title:N?.dish??'',maxWidth:640,testID:"card-sheet",children:N?(0,p.jsx)(w,{card:N,actor:'read'===d?{...n,role:'staff'}:n,onEdit:L?()=>R(N.id):void 0}):null}),(0,p.jsx)(a.Sheet,{visible:!!P,onClose:()=>R(null),title:'new'===P?'New recipe card':`Edit: ${O?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:P?(0,p.jsx)(I,{rid:e,card:O,actor:n,onDone:e=>{R(null),$(e)}},P):null})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),i=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),a=_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]),p=_r(_d[13]);const m=e=>{const s=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+s)?e:s.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},x=e=>null==e?'Price on the board':`\xa3${(e/100).toFixed(2)}`,j={example:u.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function b({card:e,testID:s}){return e.signOff?(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:`\u2713 ${h.STATE_LABEL['signed-off']}`,kind:"ok"}),(0,p.jsxs)(a.T,{size:r.font.small,colour:r.colours.ok,children:["Signed off by ",e.signOff.by," on ",m(e.signOff.at)]})]}):(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.amber,children:e.wasLive?'Edited since the last sign-off. The dish shows "awaiting allergen sign-off" to guests and cannot be ordered until the head chef signs it off.':'New dish: it stays off the menu until the head chef signs it off.'})]})}function y({card:e,height:s=180,pending:t}){const i=t?{uri:t}:e.photo?(0,d.recipeCards)().photoSource(e.photo):null;return i?(0,p.jsx)(n.default,{testID:"card-photo",accessibilityLabel:`Plating photo: ${e.dish}`,source:i,style:{width:'100%',height:s,borderRadius:12,backgroundColor:r.colours.surface2},resizeMode:"cover"}):(0,p.jsx)(l.default,{style:{height:s,borderRadius:12,backgroundColor:r.colours.surface2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:r.colours.border},children:(0,p.jsx)(a.Muted,{children:"No plating photo yet"})})}function C({map:e}){const s=c.ALLERGENS.filter(s=>e[s.id]).map(e=>e.id);return s.length?(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:s.map(s=>(0,p.jsx)(a.Badge,{label:'may'===e[s]?`May contain ${(0,c.allergenLabel)(s).toLowerCase()}`:(0,c.allergenLabel)(s),kind:'may'===e[s]?'amber':'red'},s))}):(0,p.jsx)(a.Muted,{children:"None of the UK 14 allergens."})}function w({card:e,actor:s,onEdit:n}){const[i,o]=(0,t.useState)(null),c=(0,h.signOffBlock)(e),u=j[e.origin];return(0,p.jsxs)(l.default,{testID:"card-view",style:{gap:12},children:[(0,p.jsx)(y,{card:e,height:200}),(0,p.jsxs)(a.Row,{wrap:!0,gap:6,children:[u?(0,p.jsx)(a.Badge,{label:u,kind:'example'===e.origin?'blue':'neutral'}):null,(0,p.jsx)(a.Badge,{label:e.section,kind:"gold"}),(0,p.jsx)(a.Badge,{label:x(e.price)})]}),(0,p.jsx)(b,{card:e,testID:"card-status"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens"}),(0,p.jsx)(l.default,{testID:"card-allergens",children:(0,p.jsx)(C,{map:e.allergens})}),e.allergenNotes?(0,p.jsx)(a.Muted,{children:e.allergenNotes}):null,e.allergensConfirmed?(0,p.jsxs)(a.Muted,{children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",m(e.allergensConfirmed.at),"."]}):null,(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),e.ingredients.length?e.ingredients.map(e=>(0,p.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(a.T,{style:{flex:1},children:e.name}),(0,p.jsx)(a.T,{colour:r.colours.goldLight,children:[e.qty,e.unit].filter(Boolean).join(' ')})]},e.id)):(0,p.jsx)(a.Muted,{children:"No ingredients on this card yet."}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),e.steps.length?e.steps.map((e,s)=>(0,p.jsxs)(a.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:r.colours.goldTint,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.gold,children:s+1})}),(0,p.jsx)(a.T,{style:{flex:1},children:e})]},s)):(0,p.jsxs)(a.Muted,{children:["No method yet.",(0,h.canEditCards)(s.role)?' Tap Edit to add the steps.':'']}),(0,p.jsxs)(a.Muted,{children:["Version ",e.version," \xb7 last changed ",m(e.updatedAt)," by ",e.updatedBy]}),(0,h.canEditCards)(s.role)&&n?(0,p.jsx)(a.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",onPress:n}):null,(0,h.canSignOffCards)(s.role)&&!e.signOff?(0,p.jsxs)(l.default,{style:{gap:6},children:[c?(0,p.jsx)(a.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,p.jsx)(a.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${s.name}`,disabled:!!c,onPress:async()=>{try{await(0,d.recipeCards)().signOff(e.id,s),o(null)}catch(e){o(e?.message??'Could not sign off.')}}})]}):null,!(0,h.canEditCards)(s.role)||(0,h.canSignOffCards)(s.role)||e.signOff?null:(0,p.jsx)(a.Banner,{kind:"info",title:"Head chef sign-off",children:"Only the head chef can sign off a recipe card, in the Head Chef app."}),i?(0,p.jsx)(a.Banner,{kind:"danger",children:i}):null]})}const k=()=>`i-${Math.random().toString(36).slice(2,9)}`,D=(e,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photo:e.photo,pending:null,confirm:!!e.allergensConfirmed}:{id:(0,h.uuid)(),dish:'',section:s,price:'',description:'',ingredients:[{id:k(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',pending:null,confirm:!1},v=e=>{const s=e.replace(/[\xa3\s]/g,'');if(!s)return null;const t=Number(s);return isFinite(t)&&t>=0?Math.round(100*t):'bad'};function I({rid:e,card:n,actor:u,onDone:m}){const x=(0,o.useRestaurant)(e),j=x?.sections??['Mains'],[b,C]=(0,t.useState)(()=>D(n,j[0]??'Mains')),[w,I]=(0,t.useState)(null),[T,S]=(0,t.useState)(null),[B,$]=(0,t.useState)(!1),P=e=>C(s=>({...s,...e})),R=b.ingredients.filter(e=>e.name.trim()),L={ingredients:R,allergens:b.allergens,dismissed:b.dismissed},A=(0,h.suggestAllergens)(R),M=(0,h.unresolved)(L),E=e=>{const s=b.allergens[e],t={...b.allergens};s?'contains'===s?t[e]='may':delete t[e]:t[e]='contains',P({allergens:t,dismissed:b.dismissed.filter(s=>s!==e),confirm:!1})},N=e=>{const s={...b.allergens};delete s[e],P({allergens:s,dismissed:[...new Set([...b.dismissed,e])],confirm:!1})},O=(e,s)=>P({ingredients:b.ingredients.map((t,n)=>n===e?{...t,...s}:t),confirm:!1}),H=(e,s)=>P({steps:b.steps.map((t,n)=>n===e?s:t)}),F=(e,s)=>{const t=[...b.steps],n=e+s;n<0||n>=t.length||([t[e],t[n]]=[t[n],t[e]],P({steps:t}))},_=async e=>{S(null);try{const s=await(0,f.capturePlatingPhoto)(e);s&&(P({pending:s}),S(`Compressed on this device: ${s.width}\xd7${s.height}, ${(0,f.kb)(s.bytes)}${s.originalBytes?` (was ${(0,f.kb)(s.originalBytes)})`:''}.`))}catch(e){S(e?.message??'Could not read that photo.')}},[z,W]=(0,t.useState)(!1),G=n??{id:b.id,dish:b.dish,photo:b.photo};return(0,p.jsxs)(l.default,{testID:"card-editor",style:{gap:12},children:[n?.signOff?(0,p.jsx)(a.Banner,{kind:"warn",title:"Saving a change resets the sign-off",children:"This card is signed off. Any change you save sets it back to \"Awaiting sign-off\" until the head chef signs it off again."}):null,(0,p.jsx)(a.Field,{testID:"dish-name",label:"Dish name",value:b.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),n?null:(0,p.jsx)(a.Field,{testID:"dish-description",label:"Menu description (optional)",value:b.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,p.jsx)(a.T,{size:r.font.small,weight:"medium",colour:r.colours.muted,children:"Menu section"}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:j.map(e=>(0,p.jsx)(a.Chip,{label:e,selected:b.section===e,onPress:()=>P({section:e})},e))}),(0,p.jsx)(a.Field,{testID:"dish-price",label:"Price (\xa3)",value:b.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Plating photo"}),(0,p.jsx)(y,{card:G,pending:b.pending?.dataUrl??null,height:170}),(0,p.jsxs)(a.Row,{gap:8,wrap:!0,children:[(0,p.jsx)(a.Button,{testID:"photo-camera",small:!0,kind:"secondary",label:b.pending||b.photo?'Retake photo':'Take photo',onPress:()=>_('camera')}),(0,p.jsx)(a.Button,{testID:"photo-library",small:!0,kind:"secondary",label:b.pending||b.photo?'Replace photo':'Choose photo',onPress:()=>_('library')}),b.pending||b.photo?(0,p.jsx)(a.Button,{testID:"photo-remove",small:!0,kind:"ghost",label:"Remove photo",onPress:()=>P({pending:null,photo:void 0})}):null]}),T?(0,p.jsx)(l.default,{testID:"photo-info",children:(0,p.jsx)(a.Muted,{children:T})}):(0,p.jsx)(a.Muted,{children:'shared'===(0,d.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see the photo once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),(0,p.jsx)(a.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),b.ingredients.map((e,t)=>{const n=e.name.trim()?(0,h.suggestAllergens)([e]):[];return(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(s.TextInput,{testID:`ing-qty-${t}`,accessibilityLabel:`Quantity ${t+1}`,value:e.qty,onChangeText:e=>O(t,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:64}]}),(0,p.jsx)(s.TextInput,{testID:`ing-unit-${t}`,accessibilityLabel:`Unit ${t+1}`,value:e.unit,onChangeText:e=>O(t,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:92}]}),(0,p.jsx)(s.TextInput,{testID:`ing-name-${t}`,accessibilityLabel:`Ingredient ${t+1}`,value:e.name,onChangeText:e=>O(t,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1}]}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove ingredient ${t+1}`,onPress:()=>P({ingredients:b.ingredients.filter((e,s)=>s!==t)}),hitSlop:8,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]}),n.length?(0,p.jsxs)(a.Muted,{children:["Suggests: ",n.map(c.allergenLabel).join(', ')]}):null]},e.id)}),(0,p.jsx)(a.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...b.ingredients,{id:k(),name:'',qty:'',unit:''}]})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),b.steps.map((e,t)=>(0,p.jsxs)(a.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,p.jsx)(a.T,{colour:r.colours.gold,style:{width:20,paddingTop:10},children:t+1}),(0,p.jsx)(s.TextInput,{testID:`step-${t}`,accessibilityLabel:`Step ${t+1}`,value:e,onChangeText:e=>H(t,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} up`,onPress:()=>F(t,-1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25b2"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} down`,onPress:()=>F(t,1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25bc"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove step ${t+1}`,onPress:()=>P({steps:b.steps.filter((e,s)=>s!==t)}),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]})]},t)),(0,p.jsx)(a.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...b.steps,'']})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens (UK 14)"}),(0,p.jsx)(a.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),M.length?(0,p.jsxs)(l.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,p.jsx)(a.Banner,{kind:"warn",title:`Check ${M.length} suggested allergen${1===M.length?'':'s'}`,children:M.map(e=>`${(0,c.allergenLabel)(e)} (from ${(0,h.suggestedBy)(R,e).join(', ')})`).join('; ')}),M.map(e=>(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{style:{flex:1},children:(0,c.allergenLabel)(e)}),(0,p.jsx)(a.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...b.allergens,[e]:'contains'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...b.allergens,[e]:'may'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,p.jsx)(a.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...b.allergens};M.forEach(s=>{e[s]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:c.ALLERGENS.map(e=>{const s=b.allergens[e.id],t=A.includes(e.id)&&!s&&!b.dismissed.includes(e.id),n='contains'===s?r.colours.redBg:'may'===s?r.colours.amberBg:r.colours.surface2,l='contains'===s?r.colours.red:'may'===s?r.colours.amber:t?r.colours.gold:r.colours.border;return(0,p.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===s?'contains':'may'===s?'may contain':'not marked'}`,onPress:()=>E(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:t?2:1,borderStyle:t?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,p.jsxs)(a.T,{size:r.font.small,colour:'contains'===s?'#FFD9D4':'may'===s?'#FFE2A8':r.colours.text,children:[e.short,'may'===s?' (may)':'',t?' ?':'']})},e.id)})}),b.dismissed.length?(0,p.jsxs)(a.Muted,{children:["Ruled out: ",b.dismissed.map(c.allergenLabel).join(', ')]}):null,(0,p.jsx)(a.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:b.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,p.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:b.confirm,disabled:M.length>0},disabled:M.length>0,onPress:()=>P({confirm:!b.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:b.confirm?r.colours.ok:r.colours.border,opacity:M.length?.5:1},children:[(0,p.jsx)(l.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:b.confirm?r.colours.ok:r.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:b.confirm?r.colours.okBg:'transparent'},children:b.confirm?(0,p.jsx)(a.T,{colour:r.colours.ok,children:"\u2713"}):null}),(0,p.jsx)(a.T,{style:{flex:1},children:M.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${u.name})`})]}),w?(0,p.jsx)(a.Banner,{kind:"danger",children:w}):null,(0,p.jsx)(a.Button,{testID:"card-save",label:z?'Saving\u2026':n?'Save changes':'Save card',disabled:z,onPress:async()=>{I(null);const s=v(b.price);if(!b.dish.trim())return I('Give the dish a name.');if('bad'===s)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const t=(0,d.recipeCards)();W(!0);try{let i=b.photo;b.pending&&(i=await t.savePhoto(e,b.id,b.pending));const l=b.steps.map(e=>e.trim()).filter(Boolean),r={dish:b.dish.trim(),section:b.section,price:s,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:l,allergens:b.allergens,dismissed:b.dismissed,allergenNotes:b.allergenNotes.trim()||void 0,photo:i};if(n)await t.update(n.id,{...r,confirmAllergens:b.confirm},u),m(n.id);else{const s=await t.create(e,{...r,id:b.id,description:b.description.trim()||void 0},u);b.confirm&&await t.update(s.id,{confirmAllergens:!0},u),m(s.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{W(!1)}}}),(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(u.role)?'After saving, sign the card off so it goes live.':'After saving, the head chef signs it off in the Head Chef app before it goes live.'}),n?B?(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(a.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(n)try{await(0,d.recipeCards)().remove(n.id,u),m(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,p.jsx)(a.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>$(!1)})]}):(0,p.jsx)(a.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>$(!0)}):null]})}},997,[877,30,196,263,127,821,813,819,831,814,1104,1142,1294,24]);
+__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>e.attendance),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(n.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(l.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(n.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(n.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.Muted,{size:13,children:S.intro}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(n.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(n.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(n.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(n.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(n.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:i,manager:a,by:d}){const p=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,i),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,i]);const y=(0,u.useHr)(e=>e.questions),b=(0,u.useHr)(e=>e.voted),j=(0,u.useHr)(e=>e.log),[S,k]=(0,s.useState)(''),[C,v]=(0,s.useState)('up'),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null),[D,H]=(0,s.useState)(''),[L,z]=(0,s.useState)(null),[P,W]=(0,s.useState)(''),[A,q]=(0,s.useState)(!1),[B,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{a&&A&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>N(e))},[a,A,e,j.length]);const E=(0,h.boardOrder)(y.filter(t=>t.venue===e),a),$=(B??j.filter(t=>t.venue===e)).slice(0,30);if(!p.board)return(0,c.jsx)(n.Card,{children:(0,c.jsxs)(n.Muted,{children:["The question board is switched off for this venue.",a?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(n.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:S,onChangeText:e=>{k(e),R(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===C,onPress:()=>v('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===C,onPress:()=>v('yesno')})]}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(S),onPress:()=>{u.useHr.getState().post(e,S,C,i)?(k(''),R('Posted anonymously.')):R('Write a few more words first.')}})]}),T?(0,c.jsx)(n.Muted,{size:13,children:T}):null]}),E.length?E.map(e=>(0,c.jsx)(w,{q:e,mine:b[e.id],manager:a,onHide:()=>{I(e),H('')},onReply:()=>{z(e),W(e.reply??'')},by:d},e.id)):(0,c.jsx)(n.Muted,{center:!0,children:"No questions yet. Be the first."}),a?(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(o.default,{testID:"hr-log-toggle",accessibilityRole:"button",onPress:()=>q(!A),children:(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between',minHeight:44},children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flex:1},children:"Moderation log"}),(0,c.jsx)(n.T,{colour:r.colours.gold,children:A?'Hide':'Show'})]})}),(0,c.jsx)(n.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),A?$.length?$.map(e=>(0,c.jsxs)(l.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(n.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(n.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(n.Sheet,{visible:!!M,onClose:()=>I(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(n.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:D,onChangeText:H,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:D.trim().length<3,onPress:()=>{M&&u.useHr.getState().moderate(M.id,'hide',D,d),I(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>I(null)})]})]}),(0,c.jsxs)(n.Sheet,{visible:!!L,onClose:()=>z(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[L?(0,c.jsxs)(n.Muted,{children:["\u201c",L.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:P,onChangeText:W,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(n.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!P.trim(),onPress:()=>{L&&u.useHr.getState().reply(L.id,P,d),z(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>z(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(n.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(n.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(n.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(n.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(l.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(l.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(l.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(l.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(n.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Staffing vs covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(l.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(n.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} covers`:'No bookings'})]}),(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(l.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(l.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(l.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(n.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(n.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(n.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(n.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(l.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:[(0,c.jsx)(n.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(n.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(n.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(l.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(n.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(n.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(n.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(n.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(n.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(n.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(n.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(l.default,{style:{gap:4},children:[(0,c.jsx)(n.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(n.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(l.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(n.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(l=>{const i=e===l;return(0,c.jsx)(o.default,{testID:`hr-morale-${l}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${l} of 5: ${(0,h.moraleWord)(l,s)}`,onPress:()=>t(l),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(n.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:l})},l)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsx)(l.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(l.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(l.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(n.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],l)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(n.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===l?'left':1===l?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(n.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(n.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(l.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(n.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(n.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(n.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(n.Row,{gap:8,wrap:!0,children:(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(l.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(n.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(n.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(l.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(n.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},998,[877,30,263,127,813,821,856,872,1021,1151,1152,24]);
+__d(function(g,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,"ChatAsCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return p.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return p.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>u.useOwner.getState().sys(e,t,n))},_e.ensureChat=O,_e.useChatUnread=R,_e.Chat=function({go:e}){return(0,y.jsx)(M,{children:(0,y.jsx)(z,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=e(r(d[6])),c=e(r(d[7])),h=r(d[8]),u=r(d[9]),m=r(d[10]),f=r(d[11]),x=r(d[12]),b=r(d[13]),p=r(d[14]),j=r(d[15]),y=r(d[16]);const w=(0,o.createContext)(null);function C(e){const t=(0,x.useCtx)(e),n=(0,o.useContext)(w);return n?{...t,meId:n.meId,role:n.role}:t}const v=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],S=[],k=e=>(e??'').replace(' (example)','');function O(e){if(s.LIVE_VENUE_BUILD)return;if(a.IS_WILDINGS)return;const t=u.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&u.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};u.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function R(){const{meId:e}=C(3e4),{role:t}=C(3e4),n=(0,u.useOwner)(e=>e.chat),s=(0,u.useOwner)(e=>e.staff),a=(0,u.useOwner)(t=>t.chatMuted[e]??S),i=(0,o.useMemo)(()=>T(s,e,t),[s,e,t]);return(0,o.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,p.inChannel)(n.ch,i)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,i])}function T(e,t,n){const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}class M extends o.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,y.jsxs)(c.default,{style:{gap:10},testID:"chat-error",children:[(0,y.jsx)(h.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,y.jsx)(h.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const I={owner:f.colours.gold,manager:f.colours.blue,staff:'#7a6f5c'};function P({s:e,size:n=34}){return e?(0,y.jsx)(b.StaffAvatar,{id:e.id,size:n}):(0,y.jsx)(c.default,{style:{width:n,height:n,borderRadius:n/2,backgroundColor:(0,t.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:.38*n,weight:"bold",colour:"#111",children:"CC"})})}const B=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],D=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function E({ch:e,go:s,back:a}){const{now:b,meId:w,role:S,today:O}=C(1e4),R=(0,u.useOwner)(e=>e.staff),T=(0,u.useOwner)(e=>e.chat),M=(0,u.useOwner)(e=>e.shifts),E=T.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[z,A]=(R.find(e=>e.id===w),(0,o.useState)('')),[L,$]=(0,o.useState)(null),[N,_]=(0,o.useState)(!1),[W,H]=(0,o.useState)(!1),K=e.startsWith('dm:')?e.split(':').slice(1).length:R.filter(t=>t.active&&(0,p.inChannel)(e,t)).length;(0,o.useEffect)(()=>{u.useOwner.getState().chatSeen(e,w)},[e,w,E.length]);const U=t=>u.useOwner.getState().chatSend({ch:e,from:w,at:b.toISOString(),...t});(0,i.useBackLayer)(!0,a);const Y=E.filter(e=>e.pinned&&!e.removed),V=e.startsWith('dm:')?k(R.find(t=>t.id===e.split(':').slice(1).find(e=>e!==w))?.name):v.find(t=>t.id===e)?.name,F=(0,j.useChatSync)(e=>e.synced),q=M.filter(e=>e.staffId===w&&e.published&&e.date>=O).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,y.jsxs)(c.default,{style:{gap:8},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.BackButton,{onPress:a,testID:"chat-thread-back"}),(0,y.jsxs)(c.default,{style:{flex:1,alignItems:'flex-end'},children:[(0,y.jsx)(h.T,{weight:"semibold",size:18,children:V}),(0,y.jsxs)(h.Muted,{children:[K," members"]})]})]}),Y.map(e=>(0,y.jsxs)(h.Card,{highlight:f.colours.gold,children:[(0,y.jsxs)(h.T,{size:12,colour:f.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${k(R.find(t=>t.id===e.from)?.name)}`]}),(0,y.jsx)(h.T,{size:14,children:e.text})]},e.id)),E.map((n,a)=>{const o=R.find(e=>e.id===n.from),i=n.from===w,x=n.seenBy.filter(e=>e!==n.from).length,b=0===a||n.at.slice(0,10)!==E[a-1].at.slice(0,10);return'system'===n.from?(0,y.jsxs)(c.default,{style:{alignItems:'center',gap:2},children:[b?(0,y.jsx)(h.Muted,{children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.T,{size:13,colour:/Allergy|86|Sold out/.test(n.text??'')?f.colours.amber:f.colours.muted,children:["CoverCharge \xb7 ",n.text," \xb7 ",(0,m.hm)(new Date(n.at))]})})]},n.id):(0,y.jsxs)(c.default,{style:{gap:2},children:[b?(0,y.jsx)(h.Muted,{center:!0,children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsxs)(h.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,y.jsx)(P,{s:o}),(0,y.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>$(L===n.id?null:n.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':f.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:n.pinned?f.colours.gold:f.colours.border,gap:3},children:[(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:o?I[o.role]:f.colours.muted,children:k(o?.name)}),(0,y.jsxs)(h.T,{size:11,colour:f.colours.muted,children:[o?u.ROLE_LABEL[o.role]:''," \xb7 ",(0,m.hm)(new Date(n.at))]})]}),n.removed?(0,y.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Message removed by the owner"}):(0,y.jsxs)(y.Fragment,{children:[n.photo?(0,y.jsx)(c.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:n.photo.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsxs)(h.T,{size:12,children:[n.photo.caption," (example image)"]})}):null,n.text?(0,y.jsx)(h.T,{size:15,children:n.text}):null,'cover'===n.action?(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>s('more','rota')}):null]}),Object.entries(n.reactions).filter(([,e])=>e.length).length?(0,y.jsx)(h.Row,{wrap:!0,gap:4,children:Object.entries(n.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,y.jsx)(c.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(w)?'#4a3c16':'#222'},children:(0,y.jsxs)(h.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,y.jsx)(h.T,{size:11,colour:f.colours.muted,children:x?`Seen by ${x}`:'Sent'}):null]})]}),L!==n.id||n.removed?null:(0,y.jsxs)(h.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[D.map(e=>(0,y.jsx)(l.default,{accessibilityLabel:`React ${e}`,onPress:()=>{u.useOwner.getState().chatReact(n.id,e,w),$(null)},style:{padding:4},children:(0,y.jsx)(h.T,{size:20,children:e})},e)),'staff'===S||e.startsWith('dm:')?null:(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:n.pinned?'Unpin':'Pin',onPress:()=>{u.useOwner.getState().chatPatch(n.id,{pinned:!n.pinned}),$(null)}}),'owner'!==S||i?null:(0,y.jsx)(h.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{u.useOwner.getState().chatPatch(n.id,{removed:!0,pinned:!1}),$(null)}})]})]},n.id)}),(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>_(!0),style:{padding:8},children:(0,y.jsx)(h.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,y.jsx)(n.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${V}`,placeholderTextColor:"#7D776C",value:z,onChangeText:A,style:[h.styles.input,{flex:1}]}),(0,y.jsx)(h.Button,{small:!0,label:"Send",disabled:!z.trim(),onPress:()=>{U({text:z.trim()}),A('')}})]}),(0,y.jsx)(h.Row,{wrap:!0,gap:6,children:(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>H(!0)})}),F?null:(0,y.jsx)(h.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,y.jsx)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Send a photo",children:(0,y.jsx)(h.Row,{wrap:!0,gap:8,children:B.map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{U({photo:e}),_(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsx)(h.T,{size:12,children:e.caption})},e.caption))})}),(0,y.jsxs)(h.Sheet,{visible:W,onClose:()=>H(!1),title:"Ask for shift cover",children:[q.length?null:(0,y.jsx)(h.Muted,{children:"You have no shifts on the rota this week."}),q.map(e=>(0,y.jsx)(h.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;u.useOwner.getState().addSwap({shiftId:e.id,fromId:w,kind:'cover',note:`Cover asked in chat for ${t}`}),U({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),H(!1)}},e.id)),(0,y.jsx)(h.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function z({go:e}){const{now:n,meId:s,role:a}=C(3e4),i=(0,u.useOwner)(e=>e.staff),x=(0,u.useOwner)(e=>e.chat),b=(0,u.useOwner)(e=>e.chatMuted[s]??S),{by:w}=R(),I=(0,j.useChatSync)(e=>e.synced),B=(0,j.useChatSync)(e=>e.error),D=(0,p.useKitchenExtra)(e=>e.extra),[z,A]=(0,o.useState)(null),[L,$]=(0,o.useState)(!1),[N,_]=(0,o.useState)(!1);(0,o.useEffect)(()=>{O(n)},[]),(0,o.useEffect)(()=>{A(null)},[s]);const W=T(i,s,a);if(z)return(0,y.jsx)(M,{resetKey:z,onBack:()=>A(null),children:(0,y.jsx)(E,{ch:z,go:e,back:()=>A(null)})});const H=e=>x.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],K=i.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,p.dmId)(s,e.id);return{x:e,id:t,u:w[t]??0,l:H(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||k(e.x.name).localeCompare(k(t.x.name))),U='owner'===a||'manager'===a,Y=({id:e,name:n,icon:s,avatar:a})=>{const o=H(e),u=w[e]??0,x=b.includes(e);return(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Open ${n}`,onPress:()=>A(e),style:{padding:12,borderTopWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.Row,{children:[a?(0,y.jsx)(P,{s:a}):(0,y.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,t.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:16,children:s})}),(0,y.jsxs)(c.default,{style:{flex:1},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{weight:u?'bold':'medium',children:[n,x?' \ud83d\udd15':'']}),o?(0,y.jsx)(h.Muted,{children:(0,m.hm)(new Date(o.at))}):null]}),(0,y.jsx)(h.Muted,{numberOfLines:1,children:o?o.removed?'Message removed':`${'system'===o.from?'CoverCharge':k(i.find(e=>e.id===o.from)?.name)}: ${o.text??'Photo'}`:'No messages yet'})]}),u?(0,y.jsx)(c.default,{style:{backgroundColor:x?'#555':f.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,y.jsx)(h.T,{size:11,weight:"bold",children:u})}):null]})})};return(0,y.jsxs)(c.default,{style:{gap:10},children:[I?(0,y.jsx)(c.default,{testID:"chat-synced",children:(0,y.jsx)(h.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,y.jsx)(h.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),I&&B?(0,y.jsx)(c.default,{testID:"chat-sync-error",children:(0,y.jsx)(h.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.Muted,{children:["Signed in as ",k(W?.name)," (",'Head Chef'===W?.level?'Head Chef':u.ROLE_LABEL[a],")"]}),(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>_(!0)})]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,style:{padding:10},children:"TEAM CHATS"}),v.filter(e=>'all'===e.id||(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsx)(Y,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,children:"PRIVATE MESSAGES"}),(0,y.jsx)(h.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>$(!0)})]}),K.map(e=>(0,y.jsx)(Y,{id:e.id,name:k(e.x.name),avatar:e.x},e.id)),K.length?null:(0,y.jsx)(h.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,y.jsx)(h.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,y.jsx)(h.Sheet,{visible:L,onClose:()=>$(!1),title:"New private message",children:i.filter(e=>e.active&&e.id!==s).map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{$(!1),A((0,p.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,y.jsxs)(h.Row,{children:[(0,y.jsx)(P,{s:e}),(0,y.jsxs)(c.default,{children:[(0,y.jsx)(h.T,{children:k(e.name)}),(0,y.jsxs)(h.Muted,{children:[u.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,y.jsxs)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Chat settings",children:[(0,y.jsx)(h.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,y.jsx)(h.T,{weight:"semibold",children:"Mute channels"}),v.filter(e=>(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[e.icon," ",e.name]}),(0,y.jsx)(h.Toggle,{label:`Mute ${e.name}`,value:b.includes(e.id),onChange:()=>u.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,y.jsx)(h.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),U?(0,y.jsxs)(c.default,{style:{gap:6},testID:"kitchen-members",children:[(0,y.jsx)(h.T,{weight:"semibold",children:"Kitchen chat members"}),(0,y.jsxs)(h.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",I?'':'; saved on this device for now',"."]}),i.filter(e=>e.active).map(e=>{const t=D[e.id]??(0,p.kitchenByRule)(e);return(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[k(e.name),null!=D[e.id]?' (changed)':'']}),(0,y.jsx)(h.Toggle,{label:`Kitchen chat: ${k(e.name)}`,value:t,onChange:t=>p.useKitchenExtra.getState().set(e.id,t===(0,p.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},999,[868,877,833,5,30,991,263,127,813,856,818,821,927,953,1118,1209,24]);
+__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:d,staffId:S,name:h,onOpen:w}){const D=(0,t.useRef)(h);D.current=h;const I=(0,t.useRef)(w);I.current=w,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);'orderlists'===t.get('open')&&(o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>I.current?.('orderlists'),0))},[]);const N=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),v=(0,c.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(d);const t=()=>{const t=p(),h=s.useNotifs.getState(),w=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),N=w.filter(s=>!1!==s.active&&(0,l.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of h.items){if(n.rid!==d)continue;const l=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,u.isRecipient)(n,S,w,N)){(0,f.dismissNotice)(l);continue}const{due:v,forDate:O}=(0,u.notifDue)(n,t),b=c.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!v||b||(h.snooze[R]??0)>t?(0,f.dismissNotice)(l):(0,f.notify)({id:l,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>c.useReminders.getState().markDone({rid:d,reminderId:n.id,forDate:O,at:new Date(p()).toISOString(),staffRef:S,staffName:D.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&I.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),I.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,p()+9e5)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[d,S,N,v])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15},1000,[30,956,856,1004,957,872,958,947,959]);
+__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1001,[988,30,1207,856,872,954,1108,1274,947,1103]);
+__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1002,[868,877,991,30,196,239,122,263,127,813,821,1004,1206,947,1294,1295,820,24]);
+__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.NotificationsSettings=function({rid:e}){(0,n.useEffect)(()=>{c.useNotifs.getState().ensure(e),(0,j.readPushLive)()},[e]);const t=(0,c.useNotifs)(e=>e.items).filter(t=>t.rid===e&&!t.removed),s=(0,h.useOwner)(e=>e.staff),o=(0,j.usePushLive)(),[l,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(null),[x,b]=(0,n.useState)(!1),y=c.useNotifs.getState(),T=s.map(e=>({id:e.id,role:e.role,level:e.level,job:e.job,department:e.dept,active:e.active})),v=e=>{const t=(0,u.resolveRecipients)(e,T,[]),n=[...e.recipients.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...(e.recipients.onShiftIn??[]).map(e=>u.SHIFT_FILTER_LABEL[e])];e.recipients.fallback&&n.push(`else ${[...e.recipients.fallback.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...e.recipients.fallback.staff.map(e=>I(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>I(s.find(t=>t.id===e)?.name??e));return[...n,...o].join(', ')+(t.length||(e.recipients.onShiftIn??[]).length?'':' (nobody yet)')};return(0,k.jsxs)(a.default,{style:{gap:10},testID:"notif-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: these remind people at a set time, e.g. the Mills milk order. They show in the app as a gold slider with Done and Later. Done is logged with the name and time. Times are UK time."}),(0,k.jsxs)(a.default,{testID:"push-live-status",style:{borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:10,padding:8,gap:4},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Send to phones"}),(0,k.jsx)(r.Badge,{kind:o.live?'gold':'neutral',label:o.live?'ON':'OFF'})]}),(0,k.jsx)(r.Muted,{size:12,children:o.live?'Phone notifications go to people who turned them on.':'Off: nothing goes to anyone\u2019s phone yet. In-app reminders still work.'}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:"push-live-toggle",label:o.live?'Switch phone notifications off':'Switch phone notifications on\u2026',onPress:()=>b(!0)})]}),(0,k.jsx)(R,{}),t.map(e=>l===e.id?(0,k.jsx)(D,{init:e,onCancel:()=>p(null),onSave:t=>{y.update(e.id,t),p(null)}},e.id):(0,k.jsxs)(a.default,{testID:`notif-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:12,padding:10,gap:4,opacity:e.paused?.6:1},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:e.title}),e.paused?(0,k.jsx)(r.Badge,{kind:"neutral",label:"Off"}):null]}),(0,k.jsx)(r.Muted,{size:13,children:e.message}),(0,k.jsxs)(r.Muted,{size:12,children:[(0,u.scheduleText)(e)," \xb7 ",v(e)," \xb7 ",[e.sendBy.inApp?'In app':'',e.sendBy.push?'Phone':''].filter(Boolean).join(' + ')]}),(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:`notif-edit-${e.seed??e.id}`,label:"Edit",onPress:()=>p(e.id)}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.paused?'Switch on':'Switch off',onPress:()=>y.update(e.id,{paused:!e.paused})}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>g(e)})]})]},e.id)),'new'===l?(0,k.jsx)(D,{init:C,onCancel:()=>p(null),onSave:t=>{y.add(e,t),p(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>p('new')}),(0,k.jsxs)(r.Sheet,{visible:!!f,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:f?.title}),(0,k.jsx)(r.Muted,{children:"Nobody gets it after this. Reset to default restores the configured rules."}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{label:"Remove",onPress:()=>{f&&y.remove(f.id),g(null)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>g(null)})]})]}),(0,k.jsxs)(r.Sheet,{visible:x,onClose:()=>b(!1),title:o.live?'Switch phone notifications off?':'Switch phone notifications on?',testID:"push-live-confirm",children:[(0,k.jsx)(r.T,{children:o.live?'Nothing more goes to phones. In-app reminders keep working.':'From the next scheduled time, everyone ticked on a notification with \u201cPhone notification\u201d gets it on any phone where they turned phone notifications on.'}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{testID:"push-live-yes",label:o.live?'Switch off':'Yes, switch on',onPress:()=>{(0,j.setPushLive)(!o.live).then(e=>(0,w.notify)({id:'push-live',tone:e.ok?'normal':'warn',title:e.ok?o.live?'Phone notifications are off':'Phone notifications are on':'Not changed',body:e.message??'',timeoutMs:7e3})),b(!1)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>b(!1)})]})]})]})},_e.PushButton=R,_e.OrderListsSettings=function({rid:e}){(0,n.useEffect)(()=>{p.useOrderLists.getState().ensure(e)},[e]);const s=(0,p.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,p.orderSettingsOf)(e);(0,p.useOrderLists)(t=>t.settings[e]);const l=p.useOrderLists.getState(),[c,u]=(0,n.useState)(''),[h,g]=(0,n.useState)({});return(0,k.jsxs)(a.default,{style:{gap:10},testID:"order-list-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: running lists (like Alsons drinks) collect items until you order; trip lists (like Cash and carry) are for one shopping day. Logos and phone numbers are set on each list."}),(0,k.jsx)(r.Toggle,{testID:"order-allow-staff",label:"Let all staff add items",value:o.allowStaff,onChange:t=>l.setSettings(e,{allowStaff:t})}),(0,k.jsx)(r.Muted,{size:12,children:"Staff can add items and see the lists. Only managers and the Head Chef tick, remove or finish an order."}),(0,k.jsx)(r.T,{weight:"semibold",children:"Default trip day"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:o.defaultTripDay===t,onPress:()=>l.setSettings(e,{defaultTripDay:t})},t))}),s.map(e=>(0,k.jsxs)(a.default,{testID:`order-list-row-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:10,padding:8,gap:6,opacity:e.archived?.55:1},children:[(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:`Rename ${e.name}`,value:h[e.id]??e.name,onChangeText:t=>g(s=>({...s,[e.id]:t})),onBlur:()=>{const t=(h[e.id]??'').trim();t&&t!==e.name&&l.updateList(e.id,{name:t})},style:{...T,flex:1,minWidth:0}}),(0,k.jsx)(r.Badge,{kind:"neutral",label:'trip'===e.kind?'Trip':'Running'})]}),'trip'===e.kind?(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:(e.tripDay??o.defaultTripDay)===t,onPress:()=>l.updateList(e.id,{tripDay:t})},t))}):null,(0,k.jsx)(r.Row,{gap:6,children:(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>l.updateList(e.id,{archived:!e.archived})})})]},e.id)),(0,k.jsxs)(r.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"New list name",testID:"order-new-name",value:c,onChangeText:u,placeholder:"e.g. Butcher",placeholderTextColor:d.colours.muted,style:{...T,flexGrow:1,flexBasis:160,minWidth:0}}),(0,k.jsx)(r.Button,{small:!0,label:"Add running",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'running'}),u('')}}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add trip",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'trip',tripDay:o.defaultTripDay}),u('')}})]})]})},Object.defineProperty(_e,"resetOrderLists",{enumerable:!0,get:function(){return B}}),_e.ClockAreaSettings=function({rid:e,me:c}){(0,g.useClockArea)(t=>t.areas[e]);const u=(0,g.areaOf)(e);const h=g.useClockArea.getState(),p=(0,s.privateClockVenue)(e),[f,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[v,S]=(0,n.useState)(!1),[I,C]=(0,n.useState)(''),[L,D]=(0,n.useState)(u.breakOptions.join(', ')),R=(t,s)=>{const n=Number(t),o=Number(s);t.trim()||s.trim()?Number.isFinite(n)&&Number.isFinite(o)&&Math.abs(n)<=90&&Math.abs(o)<=180&&h.set(e,{lat:n,lng:o},c):h.set(e,{lat:null,lng:null},c)},B=async()=>{if(p)return;S(!0),C('');const t=await(0,b.getFix)();if(S(!1),'object'!=typeof t)return void C('denied'===t?'Location is blocked for this app. Allow it in your browser or phone settings.':'Couldn\u2019t get your location. Try again outside or near a window.');const s=t.lat.toFixed(6),n=t.lng.toFixed(6);j(s),w(n),h.set(e,{lat:Number(s),lng:Number(n)},c),C(`Centre set to where you are (accurate to about ${Math.round(t.acc)} m).`)},P=(0,x.areaSet)(u);return(0,k.jsxs)(a.default,{style:{gap:10},testID:"clock-area-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:p?'The address-matched pub centre is configured below. Only clock-in checks location; only pass/fail is saved. No background, clock-out or break checks. Change the radius or centre here; use a manager override for a refused check.':'Tip: stand in the middle of the venue and tap \u201cUse my current location\u201d. Clocking in, out and breaks then only work within the distance below. Rota and pay screens are never blocked.'}),P?null:(0,k.jsx)(r.Banner,{kind:"warn",title:"Clock-in area not set yet",children:"Until you set the centre, staff can clock in from anywhere."}),p?(0,k.jsx)(r.Muted,{children:"Clock-in at the pub is required. A manager can record an exception with a reason."}):(0,k.jsx)(r.Toggle,{testID:"clock-area-on",label:"Check people are at the venue",value:u.on,onChange:t=>h.set(e,{on:t},c)}),p?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:v?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:v,onPress:()=>{B()}}),I?(0,k.jsx)(r.Muted,{size:13,children:I}):null,(0,k.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Latitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Latitude",testID:"clock-area-lat",value:f,onChangeText:j,onBlur:()=>R(f,y),placeholder:"55.40\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]}),(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Longitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Longitude",testID:"clock-area-lng",value:y,onChangeText:w,onBlur:()=>R(f,y),placeholder:"-4.75\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]})]}),P?(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"clock-area-map",onPress:()=>{o.default.openURL(`https://www.openstreetmap.org/?mlat=${u.lat}&mlon=${u.lng}#map=18/${u.lat}/${u.lng}`)},children:(0,k.jsx)(r.T,{size:13,colour:d.colours.gold,children:"See the pin on a map \u203a"})}):null,(0,k.jsx)(r.T,{weight:"semibold",children:"How far from the centre"}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"\u2212",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius-10)},c)}),(0,k.jsxs)(r.T,{weight:"semibold",style:{minWidth:70,textAlign:'center'},children:[u.radius," m"]}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"+",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius+10)},c)})]}),(0,k.jsxs)(r.Muted,{size:12,children:["At least ",x.MIN_RADIUS," m. Phones aren\u2019t exact, so up to 50 m of the phone\u2019s own accuracy is added on top."]}),(0,k.jsx)(r.T,{weight:"semibold",children:"Forgotten break: lengths to offer at clock-out"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Break lengths in minutes",testID:"clock-break-options",value:L,onChangeText:D,onBlur:()=>{const t=L.split(/[ ,]+/).map(Number).filter(e=>Number.isFinite(e)&&e>0&&e<=180);t.length&&h.set(e,{breakOptions:[...new Set(t)].sort((e,t)=>e-t)},c),D((0,g.areaOf)(e).breakOptions.join(', '))},style:T}),(0,k.jsxs)(r.Muted,{size:12,children:["Minutes, e.g. 5, 10, 15, 20, 30, 45, 60. Shows as ",u.breakOptions.map(x.breakLabel).join(', ')," and \u201cNo break\u201d."]}),p?(0,k.jsx)(r.Muted,{children:"No automatic arrival checks: staff location is used only at clock-in."}):(0,k.jsxs)(k.Fragment,{children:[" ",(0,k.jsx)(r.T,{weight:"semibold",children:"Not on the rota"}),(0,k.jsx)(r.Toggle,{testID:"clock-offrota-on",label:"Ask people at the venue who aren\u2019t on the rota if they want to clock in",value:u.offRotaPrompt,onChange:t=>h.set(e,{offRotaPrompt:t},c)}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota question",testID:"clock-offrota-title",value:u.offRotaTitle,onChangeText:t=>h.set(e,{offRotaTitle:t||x.DEFAULT_CLOCK_AREA.offRotaTitle},c),style:T}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota second line",testID:"clock-offrota-body",value:u.offRotaBody,onChangeText:t=>h.set(e,{offRotaBody:t||x.DEFAULT_CLOCK_AREA.offRotaBody},c),style:T}),(0,k.jsx)(r.Muted,{size:12,children:"This only checks while the app is open (web apps can\u2019t watch location in the background; that would need a native app)."})]})]})},Object.defineProperty(_e,"resetClockArea",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"COOKSAFE_URL",{enumerable:!0,get:function(){return O}}),_e.FoodSafetyCard=function({children:e}){return(0,k.jsx)(r.Card,{children:(0,k.jsxs)(a.default,{testID:"food-safety",style:{gap:6},children:[(0,k.jsx)(r.T,{size:17,weight:"semibold",children:"Food safety"}),(0,k.jsxs)(r.T,{children:["Based on ",(0,k.jsx)(r.T,{weight:"bold",colour:d.colours.gold,children:"CookSafe"})," (Food Standards Scotland)"]}),(0,k.jsx)(r.Muted,{size:12,children:"CoverCharge is not endorsed by Food Standards Scotland."}),(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"cooksafe-link",onPress:()=>{o.default.openURL(O)},children:(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"Open the CookSafe guidance \u203a"})}),(0,k.jsx)(r.Muted,{size:13,children:"Full logs coming in the next update."}),e]})})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),a=e(_r(_d[5])),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),b=_r(_d[15]),j=_r(_d[16]),y=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]);const T={minHeight:44,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},v=[1,2,3,4,5,6,0],S=['on_shift','everyone','managers','head_chef','kitchen','foh'],I=e=>e.replace(' (example)',''),C={title:'',message:'',days:[3,4,5,6,0],time:'21:00',recipients:{staff:[],groups:[]},sendBy:{inApp:!0,push:!1}};function L({value:e,onChange:t}){const s=(0,h.useOwner)(e=>e.staff).filter(e=>e.active);return(0,k.jsxs)(a.default,{style:{gap:6},testID:"notif-recipients",children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Who gets it"}),(0,k.jsx)(r.Muted,{size:12,children:"Tick people, or pick a group (groups follow the team as it changes)."}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:S.map(s=>(0,k.jsx)(r.Chip,{testID:`notif-group-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:e.groups.includes(s),onPress:()=>t({...e,groups:e.groups.includes(s)?e.groups.filter(e=>e!==s):[...e.groups,s]})},s))}),(0,k.jsx)(r.Muted,{size:12,children:"Only people on shift when it goes, in:"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:Object.keys(u.SHIFT_FILTER_LABEL).map(s=>{const n=(e.onShiftIn??[]).includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-onshift-${s}`,label:u.SHIFT_FILTER_LABEL[s],selected:n,onPress:()=>t({...e,onShiftIn:n?(e.onShiftIn??[]).filter(e=>e!==s):[...e.onShiftIn??[],s]})},s)})}),(0,k.jsx)(a.default,{style:{gap:2},children:s.map(s=>{const n=e.staff.includes(s.id);return(0,k.jsxs)(l.default,{testID:`notif-tick-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:n},onPress:()=>t({...e,staff:n?e.staff.filter(e=>e!==s.id):[...e.staff,s.id]}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:6},children:[(0,k.jsx)(a.default,{style:{width:22,height:22,borderRadius:5,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:n?'#2a2414':'transparent'},children:n?(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsx)(r.T,{style:{flex:1},children:(0,h.staffLabel)({name:I(s.name),nickname:s.nickname})}),(0,k.jsx)(r.Muted,{size:12,children:'Head Chef'===s.level?'Head Chef':s.job})]},s.id)})}),(0,k.jsx)(r.Muted,{size:12,children:"If nobody above matches when it goes, send it to:"}),(0,k.jsxs)(r.Row,{wrap:!0,gap:6,children:[S.filter(e=>'on_shift'!==e).map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.groups.includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:o,onPress:()=>{const l=o?n.groups.filter(e=>e!==s):[...n.groups,s];t({...e,fallback:l.length||n.staff.length?{...n,groups:l}:void 0})}},s)}),s.map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.staff.includes(s.id);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s.id}`,label:I(s.name),selected:o,onPress:()=>{const l=o?n.staff.filter(e=>e!==s.id):[...n.staff,s.id];t({...e,fallback:l.length||n.groups.length?{...n,staff:l}:void 0})}},s.id)})]})]})}function D({init:e,onSave:s,onCancel:o}){const[l,c]=(0,n.useState)(e),[h,p]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),f=(0,u.validateNotif)(l),g=e=>c(t=>({...t,...e}));return(0,k.jsxs)(a.default,{testID:"notif-editor",style:{gap:8,borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:12,padding:10},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Title"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification title",testID:"notif-title",value:l.title,onChangeText:e=>g({title:e}),maxLength:60,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Message"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification message",testID:"notif-message",value:l.message,onChangeText:e=>g({message:e}),maxLength:160,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Days"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(e=>(0,k.jsx)(r.Chip,{testID:`notif-day-${e}`,label:u.NOTIF_DAY_NAMES[e],selected:l.days.includes(e),onPress:()=>g({days:l.days.includes(e)?l.days.filter(t=>t!==e):[...l.days,e]})},e))}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Time (UK)"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Time",testID:"notif-time",value:l.time,onChangeText:e=>g({time:e}),placeholder:"21:00",style:{...T,width:90,borderColor:(0,u.validHm)(l.time)?d.colours.hairline:d.colours.red}})]}),(0,k.jsx)(r.Toggle,{label:"A different time on some days",value:h,onChange:e=>{p(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:v.filter(e=>l.days.includes(e)).map(e=>(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(r.T,{size:13,children:u.NOTIF_DAY_NAMES[e]}),(0,k.jsx)(t.TextInput,{accessibilityLabel:`${u.NOTIF_DAY_NAMES[e]} time`,testID:`notif-daytime-${e}`,value:l.dayTimes?.[String(e)]??'',placeholder:l.time,onChangeText:t=>{const s={...l.dayTimes??{}};t.trim()?s[String(e)]=t.trim():delete s[String(e)],g({dayTimes:s})},style:{...T,width:74}})]},e))}):null,(0,k.jsx)(L,{value:l.recipients,onChange:e=>g({recipients:e})}),(0,k.jsx)(r.T,{weight:"semibold",children:"Send by"}),(0,k.jsx)(r.Toggle,{testID:"notif-inapp",label:"In the app (gold slider, Done / Later)",value:l.sendBy.inApp,onChange:e=>g({sendBy:{...l.sendBy,inApp:e}})}),(0,k.jsx)(r.Toggle,{testID:"notif-push",label:"Phone notification (when phones are switched on)",value:l.sendBy.push,onChange:e=>g({sendBy:{...l.sendBy,push:e}})}),f?(0,k.jsx)(r.Muted,{size:13,children:f}):null,(0,k.jsxs)(r.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:o}),(0,k.jsx)(r.Button,{small:!0,testID:"notif-save",label:"Save",disabled:!!f,onPress:()=>s({...l,title:l.title.trim(),message:l.message.trim(),days:[...l.days].sort()})})]})]})}function R(){const[e,t]=(0,n.useState)(null),[s,o]=(0,n.useState)('');return(0,n.useEffect)(()=>{(0,y.pushState)().then(t)},[]),e&&'unsupported'!==e?(0,k.jsxs)(a.default,{testID:"push-button",style:{gap:4},children:[(0,k.jsx)(r.Button,{small:!0,kind:'on'===e?'ghost':'secondary',testID:"push-turn-on",label:'on'===e?'Phone notifications are on for this phone \xb7 Turn off':'\ud83d\udd14 Turn on phone notifications',onPress:()=>{('on'===e?(0,y.turnOffPush)():(0,y.turnOnPush)()).then(e=>{o(e.message),(0,y.pushState)().then(t)})}}),(0,k.jsx)(r.Muted,{size:12,children:s||('ios-home-screen'===e?'iPhone: add this app to your Home Screen first (iOS 16.4 or later).':'For this phone only. Each person turns it on on their own phone.')})]}):null}const B=e=>p.useOrderLists.getState().resetSettings(e);const P=(e,t)=>g.useClockArea.getState().reset(e,t),O='https://www.foodstandards.gov.scot/publications-and-research/publications/cooksafe-manual'},1003,[877,988,30,239,263,127,813,821,956,958,856,1004,1206,1207,954,1274,820,1097,947,24]);
+__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1004,[1116,952,1117,1104,1206,1033,1205]);
+__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return N}}),_e.personFromStaff=E,_e.signInWithText=z,_e.SignInWithLink=M,_e.useSignedOutGate=function(){const e=(0,m.useSession)(e=>e.meId);return _.includes(b.APP_VARIANT)&&!A.PITCH&&!e},_e.InviteGate=function(){const[e,R]=(0,f.useState)(m.useSession.persist.hasHydrated()),[E,z]=(0,f.useState)(m.START_INVITE?'checking':'done'),[V,F]=(0,f.useState)(null),[W,D]=(0,f.useState)(0),[K,U]=(0,f.useState)(!1),[G,Y]=(0,f.useState)(null),B=(0,m.useSession)(e=>e.meId),$=(0,m.useSession)(e=>!B||!!e.welcomed[B]);if((0,f.useEffect)(()=>{const e=m.useSession.persist.onFinishHydration(()=>R(!0));return m.useSession.persist.hasHydrated()&&R(!0),e},[]),(0,f.useEffect)(()=>{if(!e||!_.includes(b.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=m.useSession.getState().meId;if(m.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(m.START_INVITE))){const e=await H(m.START_INVITE,e=>{t&&F(e)});if(!t)return;if('refused'===e.kind)return F(e.message),void z('done');if('offline'===e.kind)return U(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(U(!1),'bad'===e.kind)return void z('bad')}const s=O(m.useSession.getState().meId),o=s&&!1!==P.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)m.useSession.getState().signOut();else if(s&&!C(s)&&!m.START_INVITE&&await(0,I.signedInHereAs)(s.id)){if(await(0,I.forgetSignInHere)(),!t)return;m.useSession.getState().signOut(),Y(N(s.app))}else if(s&&!C(s)){const e=(0,m.appUrl)(s.app,m.START_INVITE);if(e)return void window.location.replace(e)}z('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!_.includes(b.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.AbbotsfordStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(u.KirktonStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(n.IS_WILDINGS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(o.WildingsStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Wildings app\u2026'})});if(n.IS_KIRKMICHAEL&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.KirkmichaelStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Kirkmichael app\u2026'})});if(n.IS_SOUTERS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(c.SoutersStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team'})});if(K)return w('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===E)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,S.inPhoneApp)()&&!B&&!A.PITCH)return V&&/already been used/i.test(V)?w(j,'invite-app-used'):V?w(V,'invite-app-refused'):w(v,'invite-app-notsetup');if('bad'===E)return(0,x.jsxs)(h.default,{testID:"invite-bad",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>z('done')}),(0,x.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(V&&!B)return(0,x.jsxs)(h.default,{testID:"invite-refused",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(T.Muted,{center:!0,children:V}),(0,x.jsx)(T.Muted,{center:!0,children:"Each personal link works on one phone only and lasts 30 days before first use, so nobody else can sign in as you."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F(null)})]});if(G&&!B)return(0,x.jsxs)(h.default,{testID:"invite-moved",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(T.Muted,{center:!0,children:G}),(0,x.jsx)(M,{})]});if(!B&&!A.PITCH)return(0,x.jsxs)(h.default,{testID:"invite-signin",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:V?'This link can\u2019t be used here':'Sign in to CoverCharge'}),V?(0,x.jsx)(T.Muted,{center:!0,children:V}):null,(0,x.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager sent you on this phone. Each link signs in one person on one phone and lasts 30 days before first use. If it has already been used on another phone or browser, ask your manager for a new one."}),(0,x.jsx)(M,{})]});const L=(0,m.rosterPerson)(B);return L&&!$&&C(L)?(0,x.jsx)(y.LaunchWelcome,{p:L,onDone:()=>m.useSession.getState().markWelcomed(L.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),f=_r(d[8]);_r(d[9]);var p=e(_r(d[10])),h=e(_r(d[11])),b=_r(d[12]),m=_r(d[13]),k=_r(d[14]),y=_r(d[15]),T=_r(d[16]),I=_r(d[17]),A=_r(d[18]),S=_r(d[19]),P=_r(d[20]),x=_r(d[21]);const j='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',w=(e,n)=>(0,x.jsx)(h.default,{testID:n,style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),_=['owner','staff','chef'],C=e=>'staff'===b.APP_VARIANT||e.app===b.APP_VARIANT,N=e=>`You now use ${m.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){m.useSession.getState().signIn(e.id);const n=P.useOwner.getState();P.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,m.rosterPerson)(e);if(n)return n;const t=e?P.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function H(e,n){const t=await(0,m.personForInvite)(e);if(t)return R(t),C(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&m.useSession.getState().meId===t.id&&(m.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==m.useSession.getState().meId){const n=O(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,I.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??E({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return R(o),{kind:'ok',p:o}}async function z(e,n=()=>{}){const t=(0,m.inviteFromText)(e);if(!t)return'bad';const s=await H(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!C(o)){const e=(0,m.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function M(){const[e,n]=(0,f.useState)(''),[t,s]=(0,f.useState)('');return(0,x.jsxs)(h.default,{style:{gap:6},children:[(0,x.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,x.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await z(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,x.jsx)(T.T,{size:13,colour:k.colours.red,children:t}):null]})}},1005,[5,1398,1399,1400,1401,1402,1403,854,30,122,46,127,806,859,821,1404,813,820,2,1290,856,24]);
+__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1006,[30,948,24]);
+__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>e.attendance),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:N}=(0,y.useCtx)(6e4),v=(0,b.useVenuePay)(N).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,v,z),person:e})),[k,B,R,D,v,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>e.attendance),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>e.attendance),N=(0,a.useOwner)(e=>e.troncHistory),v=(0,y.useHourly)(),B=v[D]??0,O=null!=v[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,N)})),[D,M,B,R,N]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,64][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:64},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1007,[877,1338,30,263,127,287,813,856,816,818,821,1018,927,1111,24]);
+__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return b.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return b.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:n,source:r}=(0,b.useVenuePay)(s),[l,c]=(0,o.useState)(n),[p,y]=(0,o.useState)((0,u.ukDate)(n.tipsAnchorPayday)),[C,S]=(0,o.useState)(null),D=(0,u.parseUk)(p),M=(0,u.cleanPay)({...l,tipsAnchorPayday:D??l.tipsAnchorPayday}),B=JSON.stringify(M)!==JSON.stringify(n)||'settings'!==r,R=(0,u.nextToPay)(M,'tips',t).period,z=(0,u.nextToPay)(M,'wage',t).period,v=(0,u.tipsPeriod)(M,R.start,1),$=(0,u.wagePeriod)(M,z.start,1),O=e=>{c({...l,...e}),S(null)};return(0,j.jsxs)(d.default,{style:{gap:12},testID:"pay-settings",children:['none'===r?(0,j.jsx)(i.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===r?(0,j.jsx)(i.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,j.jsx)(f.SectionHead,{title:"Tips (tronc)",sub:"How often tips are paid out, and which days each payout covers."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"How often"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,j.jsx)(i.Chip,{label:w[e],selected:l.tipsFrequency===e,onPress:()=>O({tipsFrequency:e})},e))}),(0,j.jsx)(i.Field,{label:"A tips payday (DD/MM/YYYY). Every other one is worked out from it",value:p,onChangeText:e=>{y(e),S(null)},placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),D?(0,j.jsxs)(i.Muted,{children:[(0,u.dayMonth)(D)," ",D.slice(0,4)]}):(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter a date like 02/11/2026"}),(0,j.jsx)(i.T,{weight:"semibold",children:"Each tips period ends"}),(0,j.jsxs)(i.Row,{children:[(0,j.jsx)(i.Stepper,{label:"days before payday",value:l.tipsEndsDaysBefore,min:0,max:13,onChange:e=>O({tipsEndsDaysBefore:e})}),(0,j.jsx)(i.Muted,{style:{flex:1},children:0===l.tipsEndsDaysBefore?'on payday':1===l.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,j.jsx)(f.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,j.jsx)(i.Stepper,{label:"pay day",value:l.wagePayDay,min:1,max:31,onChange:e=>O({wagePayDay:e})})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,j.jsx)(i.Stepper,{label:"cut-off day",value:l.wageCutoffDay,min:1,max:28,onChange:e=>O({wageCutoffDay:e})})]}),(0,j.jsxs)(i.Muted,{children:["Period runs the ",P(l.wageCutoffDay)," to the ",P(1===l.wageCutoffDay?31:l.wageCutoffDay-1),1===l.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,j.jsx)(i.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,j.jsx)(i.Chip,{label:T[e],selected:(l.weekendRule??'none')===e,onPress:()=>O({weekendRule:e})},e))})]}),(0,j.jsx)(f.SectionHead,{title:"Preview"}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(k,{label:"Next tips payday",day:R.payday,period:R}),(0,j.jsx)(k,{label:"Then",day:v.payday,period:v}),(0,j.jsx)(d.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,j.jsx)(k,{label:"Next payday",day:z.payday,period:z}),(0,j.jsx)(k,{label:"Then",day:$.payday,period:$})]}),(0,j.jsx)(i.Button,{kind:"success",label:'settings'===r?'Save pay dates':'Save as our pay dates',disabled:!D||!B,testID:"save-pay",onPress:()=>{a.useStore.getState().updateSettings(s,{pay:M}),S('Saved. Everyone in the venue sees these dates.')}}),C?(0,j.jsx)(i.Banner,{kind:"success",title:C}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=S,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return $}}),_e.summaryTable=O,_e.detailTable=H,_e.copyText=I,_e.periodOptions=W,_e.PayrollHours=function({go:e}){const{rid:s,today:n,now:a,r:y}=(0,x.useCtx)(6e4),{pay:f,source:w}=(0,b.useVenuePay)(s),T=(0,l.useOwner)(e=>e.staff),P=(0,l.useOwner)(e=>e.attendance),k=(0,x.useHourly)(),C=(0,o.useMemo)(()=>W(f,n),[f,n]),[B,R]=(0,o.useState)('wage'),[z,F]=(0,o.useState)(null),[V,A]=(0,o.useState)(!1),[E,Y]=(0,o.useState)({}),[G,U]=(0,o.useState)(null),_='custom'===B&&z?z:(C.find(e=>e.id===B)??C[0]).period,q=(0,o.useMemo)(()=>S(_,T,P,a,k),[_.key,T,P,k,Math.floor(a.getTime()/6e4)]),J=q.some(e=>null!=e.rate),K='tips'===_.kind,Q=q.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),X=q.filter(e=>e.pending>0).length,Z=`${y.name}: hours ${(0,u.rangeText)(_.start,_.end)}`,ee=`hours-${_.start}-to-${_.end}`,se=e=>{U(e),setTimeout(()=>U(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"payroll-hours",children:['none'===w?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using calendar months for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[C.map(e=>(0,j.jsx)(i.Chip,{label:e.label,sub:e.sub,selected:B===e.id,onPress:()=>{R(e.id),A(!1)}},e.id)),(0,j.jsx)(i.Chip,{label:"Custom dates",sub:z&&'custom'===B?(0,u.rangeText)(z.start,z.end):'Pick any range',selected:'custom'===B,onPress:()=>A(!V)})]}),V?(0,j.jsx)(N,{onSet:e=>{F(e),R('custom'),A(!1)}}):null,(0,j.jsx)(i.Card,{highlight:h.colours.gold,children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(d.default,{style:{flexShrink:1,minWidth:0},children:[(0,j.jsxs)(i.T,{weight:"bold",size:18,children:[(0,u.rangeText)(_.start,_.end)," ",_.end.slice(0,4)]}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(_.start)," to ",(0,u.ukDate)(_.end),_.payday?` \xb7 ${_.payday>=n?'pays':'paid'} ${(0,u.dayMonth)(_.payday)}`:'',K?' \xb7 tips period':'wage'===_.kind?' \xb7 wage period':'']})]}),(0,j.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,j.jsxs)(i.T,{size:22,weight:"bold",colour:h.colours.gold,children:[(0,u.decH)(Q.c)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(Q.c),")"]})]})]})}),X?(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.amber,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.amber,children:["\u26a0 ",(0,u.decH)(Q.p)," h still waiting for sign-off (",X," ",1===X?'person':'people',")"]}),(0,j.jsx)(i.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await I(v(O(q,_,J,K)));se(e?`Copied ${q.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,p.downloadText)(`${ee}.csv`,$(O(q,_,J,K))),se('CSV downloaded (summary).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,p.downloadText)(`${ee}-daily.csv`,$(H(q))),se('CSV downloaded (one line per shift).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=O(q,_,J,K);(0,p.printTable)(Z,`${(0,u.ukDate)(_.start)} to ${(0,u.ukDate)(_.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,u.ukDate)(n)}`,e[0],e.slice(1))}})]}),G?(0,j.jsx)(i.Banner,{kind:"success",title:G}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"hours-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:L[s]},children:e},s))}),q.map(e=>{const s=!!E[e.person.id];return(0,j.jsxs)(d.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`${M(e.person)} daily hours`,onPress:()=>Y({...E,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,j.jsxs)(t.TRow,{heads:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''],children:[(0,j.jsxs)(d.default,{style:{width:L[0]},children:[(0,j.jsxs)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",M(e.person)]}),(0,j.jsx)(i.Muted,{numberOfLines:1,children:D(e.person)})]}),(0,j.jsx)(i.T,{size:14,style:{width:L[1]},children:e.shifts}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[2]},children:(0,u.decH)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?h.colours.amber:h.colours.muted,style:{width:L[3]},children:e.pending?`\u26a0 ${(0,u.decH)(e.pending)}`:'0.00'}),(0,j.jsx)(i.T,{size:14,style:{width:L[4]},children:K?(0,u.decH)(e.confirmed):(0,u.hMm)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:L[5]},children:J?null!=e.rate?(0,c.gbp)(e.rate):'\u2013':''}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[6]},children:J?null!=e.gross?(0,c.gbp)(e.gross):'\u2013':''})]})}),s?(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.surface2,borderRadius:8,padding:8,marginBottom:8,gap:2},testID:`daily-${e.person.id}`,children:[(0,j.jsx)(t.TRow,{head:!0,children:['Date','In','Out','Break','Paid','Status'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[96,52,52,52,56,90][s]},children:e},e))}),e.days.map(e=>(0,j.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Status'],children:[(0,j.jsx)(i.T,{size:13,style:{width:96},children:(0,u.dayMonth)(e.date)}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.inT}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.outT||'\u2013'}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:'On now'===e.status?'\u2013':`${e.brk}m`}),(0,j.jsx)(i.T,{size:13,style:{width:56},children:'On now'===e.status?'\u2013':(0,u.hMm)(e.paid)}),(0,j.jsx)(i.T,{size:13,weight:"semibold",style:{width:90},colour:'Confirmed'===e.status?h.colours.ok:'Pending'===e.status?h.colours.amber:h.colours.blue,children:e.status})]},e.a.id)),e.days.length?null:(0,j.jsx)(i.Muted,{children:"No clocked shifts in this period."})]}):null]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','Shifts','Confirmed','Pending',K?'Tips h':'h:mm','',J?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:L[0]},children:["Total (",q.length,")"]}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[1]},children:Q.s}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:h.colours.gold,style:{width:L[2]},children:(0,u.decH)(Q.c)}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:Q.p?h.colours.amber:h.colours.muted,style:{width:L[3]},children:(0,u.decH)(Q.p)}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[4]},children:K?(0,u.decH)(Q.c):(0,u.hMm)(Q.c)}),(0,j.jsx)(i.T,{size:14,style:{width:L[5]},children:" "}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[6]},children:J?(0,c.gbp)(Q.g):''})]})]})}),(0,j.jsxs)(i.Muted,{children:["Tap a name for each day. Hours are decimal (37.50 = 37 hours 30 minutes); h:mm is also in the export. Paid hours = clock out \u2212 clock in \u2212 break. ",J?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),K?(0,j.jsx)(i.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:n,today:a,now:f}=(0,x.useCtx)(6e4),{pay:w,source:T}=(0,b.useVenuePay)(n),P=(0,l.useOwner)(e=>e.staff),k=(0,l.useOwner)(e=>e.attendance),C=(0,l.useOwner)(e=>e.tronc),R=(0,u.nextToPay)(w,'tips',a),[z,O]=(0,o.useState)(0),H=(0,u.tipsPeriod)(w,R.period.start,z),[W,N]=(0,o.useState)(''),[L,F]=(0,o.useState)({}),[V,A]=(0,o.useState)(null),E=(0,o.useMemo)(()=>S(H,P,k,f,{}),[H.key,P,k]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,G=e=>L[e.id]??Y(e),U=E.filter(e=>e.confirmed>0||e.pending>0),_=Math.round(100*Number(W.replace(/[\xa3,\s]/g,''))),q=Number.isFinite(_)&&_>0&&_<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(W),J=U.filter(e=>!G(e.person)&&e.confirmed>0),{amounts:K}=(0,y.allocate)(q?_:0,J.map(e=>e.confirmed)),Q={};J.forEach((e,s)=>{Q[e.person.id]=K[s]});const X=J.reduce((e,s)=>e+s.confirmed,0),Z=Object.values(Q).reduce((e,s)=>e+s,0),ee=U.filter(e=>e.pending>0&&!G(e.person)),se=ee.reduce((e,s)=>e+s.pending,0),te=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...U.map(e=>{const s=!G(e.person)&&e.confirmed>0;return[M(e.person),D(e.person),(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),s&&X?(e.confirmed/X*100).toFixed(2):'0.00',s?B(Q[e.person.id]??0):G(e.person)?'excluded':'0.00']}),['TOTAL','',(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(X),(0,u.hMm)(X),X?'100.00':'0.00',B(Z)]],oe=e=>{A(e),setTimeout(()=>A(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"tips-day",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===T?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using weekly tips for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:z<=-6,onPress:()=>O(z-1)}),(0,j.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,j.jsx)(i.T,{weight:"bold",size:18,children:(0,u.rangeText)(H.start,H.end)}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(H.start)," to ",(0,u.ukDate)(H.end)," \xb7 ",H.payday>=a?'paid':'was paid'," ",(0,u.dayMonth)(H.payday)]}),0===z?(0,j.jsx)(i.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:z>=1,onPress:()=>O(z+1)})]}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Total tips to share"}),(0,j.jsxs)(i.Row,{style:{alignItems:'center'},children:[(0,j.jsx)(i.T,{size:28,weight:"bold",colour:h.colours.gold,children:"\xa3"}),(0,j.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:W,onChangeText:N,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[i.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),W&&!q?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter an amount like 1250.00"}):(0,j.jsx)(i.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),ee.length?(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.red,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.red,children:["\u26a0 Don't pay out yet: ",(0,u.decH)(se)," h not signed off"]}),(0,j.jsxs)(i.T,{size:14,children:[ee.map(e=>`${M(e.person)} (${(0,u.decH)(e.pending)} h)`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):U.length?(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"tips-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[64,150,80,64,84][s]},children:e},e))}),U.map(e=>{const s=G(e.person),o=Q[e.person.id]??0;return(0,j.jsxs)(t.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,j.jsx)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${M(e.person)}`,onPress:()=>F({...L,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,j.jsx)(d.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?h.colours.muted:h.colours.ok,backgroundColor:s?'transparent':h.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.T,{size:14,colour:h.colours.ok,children:s?'':'\u2713'})})}),(0,j.jsxs)(d.default,{style:{width:150},children:[(0,j.jsx)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:M(e.person)}),(0,j.jsxs)(i.Muted,{numberOfLines:1,children:[s?'Excluded':D(e.person),e.pending?` \xb7 \u26a0 ${(0,u.decH)(e.pending)} h pending`:'']})]}),(0,j.jsxs)(i.T,{size:14,style:{width:80},children:[(0,u.decH)(e.confirmed)," h"]}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:64},children:!s&&X?`${(e.confirmed/X*100).toFixed(1)}%`:'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:s?h.colours.muted:h.colours.gold,style:{width:84},children:s?'\u2013':(0,c.gbp)(o)})]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsx)(i.T,{size:14,style:{width:64},children:" "}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:150},children:["Total (",J.length," people)"]}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:80},children:[(0,u.decH)(X)," h"]}),(0,j.jsx)(i.T,{size:14,style:{width:64},children:X?'100%':'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:q&&Z===_?h.colours.ok:h.colours.text,style:{width:84},children:(0,c.gbp)(Z)})]})]})}),U.length?null:(0,j.jsx)(i.Muted,{children:"No clocked hours in this fortnight yet."}),q&&X?(0,j.jsxs)(i.Muted,{children:["Check: ",J.length," shares add up to ",(0,c.gbp)(Z)," of ",(0,c.gbp)(_)," ",Z===_?'\u2713':'',". \xa3",(_/100/(X/60)).toFixed(4)," per confirmed hour."]}):null,(0,j.jsxs)(i.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips (tronc)). Tick or untick anyone for this split."]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!q,onPress:async()=>{const e=await I(v(te()));oe(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!q,onPress:()=>{(0,p.downloadText)(`tips-${H.start}-to-${H.end}.csv`,$(te())),oe('CSV downloaded.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!q,onPress:()=>{const e=te();(0,p.printTable)(`Tips ${(0,u.rangeText)(H.start,H.end)} (paid ${(0,u.dayMonth)(H.payday)})`,`Total ${(0,c.gbp)(_)} shared by confirmed hours${ee.length?` \xb7 WARNING ${(0,u.decH)(se)} h not signed off`:''}`,e[0],e.slice(1))}})]}),V?(0,j.jsx)(i.Banner,{kind:"success",title:V}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:o,source:r}=(0,b.useVenuePay)(s),a=(0,u.nextToPay)(o,'tips',t).period,l=(0,u.nextToPay)(o,'wage',t).period;return(0,j.jsxs)(d.default,{testID:"paydays-card",style:{backgroundColor:h.colours.surface,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,padding:16,gap:8},children:[(0,j.jsx)(n.CardHeading,{right:'none'===r?(0,j.jsx)(i.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next tips payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:a.payday===t?'today':(0,u.dayMonth)(a.payday)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(a.start,a.end)})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:l.payday===t?'today':(0,u.dayMonth)(l.payday)})]}),(0,j.jsxs)(i.Muted,{children:["period ",(0,u.rangeText)(l.start,l.end)]})]}),(0,j.jsxs)(n.ActionGrid,{testID:"paydays-actions",children:[(0,j.jsx)(n.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,j.jsx)(n.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==r?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,x.useCtx)(6e4),r=e??n,{pay:a}=(0,b.useVenuePay)(s),c=(0,l.useOwner)(e=>e.attendance),p=(0,l.useOwner)(e=>e.staff.find(e=>e.id===r)),y=(0,u.wagePeriod)(a,t,0),f=(0,u.tipsPeriod)(a,t,0),w=e=>p?S(e,[p],c,o,{})[0]??null:null,T=(e,s,o)=>(0,j.jsxs)(d.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:h.colours.surface,borderRadius:14,borderWidth:1,borderColor:h.colours.border,padding:12,gap:2},children:[(0,j.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:e.toUpperCase()}),(0,j.jsxs)(i.Muted,{children:[(0,u.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,u.dayMonth)(s.payday)]}),(0,j.jsxs)(i.T,{size:24,weight:"bold",children:[(0,u.decH)(o?.confirmed??0)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(o?.confirmed??0),") \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,j.jsxs)(i.T,{size:13,colour:h.colours.amber,children:["+ ",(0,u.decH)(o.pending)," h waiting for sign-off"]}):null]},e);return(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[T('This pay period',y,w(y)),T('This tips fortnight',f,w(f))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var r=e(_r(_d[5])),d=e(_r(_d[6])),i=_r(_d[7]),a=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]);const w={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},T={none:'Keep the date',before:'Friday before',after:'Monday after'};const P=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function k({label:e,day:s,period:t}){return(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:[e,": ",(0,j.jsx)(i.T,{weight:"bold",colour:h.colours.gold,children:(0,u.dayMonth)(s)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(t.start,t.end)})]})}const C=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function S(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,x.paidMins)(e,o),t=(0,l.attStatus)(e);return{a:e,date:e.date,inT:C(e.in),outT:C(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),i=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:i,gross:null!=i?Math.round(d/60*i):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const D=e=>`${l.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,M=e=>e.name.replace(' (example)',''),B=e=>null==e?'':(e/100).toFixed(2),R=e=>e.replace(/[\t\r\n]+/g,' '),z=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,v=e=>e.map(e=>e.map(R).join('\t')).join('\n'),$=e=>e.map(e=>e.map(z).join(',')).join('\r\n');function O(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[M(e.person),D(e.person),(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),(0,u.decH)(e.pending),(0,u.hMm)(e.pending),String(e.shifts),...o?[(0,u.decH)(e.confirmed)]:[],...t?[B(e.rate),B(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(d.c),(0,u.hMm)(d.c),(0,u.decH)(d.p),(0,u.hMm)(d.p),String(d.s),...o?[(0,u.decH)(d.c)]:[],...t?['',B(d.g)]:[]]]}function H(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[M(e.person),D(e.person),(0,u.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,u.decH)(s.paid),'On now'===s.status?'':(0,u.hMm)(s.paid),s.status]))]}async function I(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function W(e,s){const t=(0,u.nextToPay)(e,'wage',s),o=(0,u.nextToPay)(e,'tips',s),n=(0,u.wagePeriod)(e,t.period.start,-1),r=(0,u.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,u.dayMonth)(e.payday)}`:`Paid ${(0,u.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,u.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,u.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,u.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,u.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function N({onSet:e}){const[s,t]=(0,o.useState)(''),[n,r]=(0,o.useState)(''),a=(0,u.parseUk)(s),l=(0,u.parseUk)(n),c=!!a&&!!l&&l>=a&&(0,u.plusDays)(a,92)>=l;return(0,j.jsxs)(i.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:t,placeholder:"23/10/2026"})}),(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"To (DD/MM/YYYY)",value:n,onChangeText:r,placeholder:"22/11/2026"})}),(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Show",disabled:!c,onPress:()=>c&&e((0,u.customPeriod)(a,l))}),s&&n&&!c?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const L=[150,54,62,62,48,62,70]},1008,[877,1338,30,1339,122,263,127,813,872,856,816,1110,821,1340,1010,1018,927,1111,24]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=F,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,C.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,C.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),x=(0,f.useOwner)(e=>e.swaps),[I,v]=(0,l.useState)(0),[D,T]=(0,l.useState)(null),[$,M]=(0,l.useState)(null),[R,P]=(0,l.useState)('week'),[z,H]=(0,l.useState)(''),[W,E]=(0,l.useState)(''),[_,q]=(0,l.useState)(''),K='staff'!==t,U=(0,b.addMins)(L(e),7*I*1440);U.setHours(0,0,0,0);const V=F(U),G=V.sales,X='none'===V.mode,J=Array.from({length:7},(e,t)=>{const s=new Date(U);return s.setDate(U.getDate()+t),(0,b.ymd)(s)}),Q=(0,f.visibleShifts)(i,K).filter(e=>e.date>=J[0]&&e.date<=J[6]),Z=(()=>{const e=new Date(U);return e.setDate(e.getDate()-7),(0,b.ymd)(e)})(),ee=Q.filter(e=>!e.published||e.changed).length,te=i.filter(e=>e.date>=Z&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),ne=J.map(e=>Q.filter(t=>t.date===e).reduce((e,t)=>{return e+(A(s=t)-Y(A(s)))*(h[s.staffId]??0);var s},0)),ae=ne.reduce((e,t)=>e+t,0),oe=G.reduce((e,t)=>e+t,0),ie=(e,t)=>t?Math.round(e/t*100):0,le=K?o:o.filter(e=>e.id===n),re=(0,a.useNarrow)(),de=Math.max(0,J.indexOf((0,b.ymd)(e))),[ce,ue]=(0,l.useState)(null),he=ce??de,fe=(e,t)=>!re||t===he,me=re?150:74;return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Week",selected:'week'===R,onPress:()=>P('week')}),(0,B.jsx)(u.Chip,{label:`Swaps & leave (${x.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===R,onPress:()=>P('requests')}),(0,B.jsx)(u.Chip,{label:"Availability",selected:'availability'===R,onPress:()=>P('availability')})]}),'week'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{v(I-1),T(null)}}),(0,B.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,b.niceDate)(U)]}),(0,B.jsxs)(u.Muted,{children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",K?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{v(I+1),T(null)}})]}),K?(0,B.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(te?` (${te})`:''),disabled:!te,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(Z,J[0]);T(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,B.jsx)(u.Button,{small:!0,kind:"success",label:ee?`Publish ${ee} ${1===ee?'change':'changes'}`:'Week published',disabled:!ee,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(J[0]);T(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),ee?(0,B.jsx)(u.Badge,{kind:"amber",label:`${ee} unpublished`}):Q.length?(0,B.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,D?(0,B.jsx)(u.Banner,{kind:"success",title:D}):null,re?(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:C.DAY3.map((e,t)=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,b.parseYmd)(J[t]).getDate()}`,selected:t===he,onPress:()=>ue(t)},e))}):null,(0,B.jsx)(d.default,{horizontal:!re,showsHorizontalScrollIndicator:!0,children:(0,B.jsxs)(c.default,{style:{gap:4},children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:126}}),C.DAY3.map((t,s)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsxs)(u.T,{size:12,weight:"semibold",colour:J[s]===(0,b.ymd)(e)?w.colours.gold:w.colours.text,children:[t," ",(0,b.parseYmd)(J[s]).getDate()]})},t)).filter(fe)]}),le.map(e=>(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:26}),(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,B.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),C.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(Q,e.id,J[s]),a=(m[e.id]??[]).includes(s),o=se(e.id,J[s]);return(0,B.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${C.DAY3[s]} ${n?`${(0,C.fmtH)(n.start)} to ${(0,C.fmtH)(n.end)}`:'no shift'}`,disabled:!K,onPress:()=>M({staffId:e.id,date:J[s],shift:n}),style:{width:me,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?w.colours.gold:w.colours.amber:w.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,B.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,C.fmtH)(n.start),"\u2013",(0,C.fmtH)(n.end)]}):(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:o?'Leave':a?'Unavail.':K?'Add':'\u2013'}),n&&(a||o)?(0,B.jsx)(u.T,{size:9,colour:w.colours.red,children:o?'on leave!':'unavailable'}):n&&K&&(!n.published||n.changed)?(0,B.jsx)(u.T,{size:9,colour:w.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(fe)]},e.id)),K?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour"})}),ne.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,children:(0,j.gbp)(e).replace('.00','')})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:'example'===V.mode?'Fcst sales (ex.)':'Fcst sales'})}),G.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour %"})}),ne.map((e,t)=>{const s=ie(e,G[t]);return(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,weight:"semibold",colour:G[t]?s>32?w.colours.red:s>26?w.colours.amber:w.colours.ok:w.colours.muted,children:G[t]?`${s}%`:'\u2013'})},t)}).filter(fe)]})]}):null]})}),K&&X?(0,B.jsx)(u.Card,{children:(0,B.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,B.jsx)(c.default,{testID:"labour-week-cost",children:(0,B.jsx)(u.T,{weight:"semibold",children:(0,j.gbp)(ae)})})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,B.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===V.weeks?'1 week':`${V.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),V.booked?(0,B.jsx)(c.default,{testID:"labour-booked",children:(0,B.jsxs)(u.T,{children:["Booked so far: ",V.booked," covers this week"]})}):null]})}):null,K&&!X?(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,B.jsxs)(u.Row,{gap:6,children:['example'===V.mode?(0,B.jsx)(O.ExampleBadge,{}):null,(0,B.jsx)(u.Badge,{kind:ie(ae,oe)>30?'red':'ok',label:`${ie(ae,oe)}% this week`})]})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,j.gbp)(oe)," forecast sales. Target 25\u201330%. ",'example'===V.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ie(ne[5],G[5]);return e&&e<24?(0,B.jsxs)(u.T,{size:14,colour:w.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,K?(0,B.jsx)(u.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>K||e.fromId===n||e.toId===n).map(e=>{const t=i.find(t=>t.id===e.shiftId),s=o.find(t=>t.id===e.fromId),n=o.find(t=>t.id===e.toId);return(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[t?`${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(t=>t.id!==e.fromId&&'owner'!==t.role).map(t=>(0,B.jsx)(u.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{f.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,B.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId,onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,y.autoPost)('all','swap'===e.kind?`Shift swap: ${s(e.fromId)} \u2194 ${s(e.toId)} approved`:`Cover approved: ${s(e.toId)} covers ${s(e.fromId)}${t?` (${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)})`:''}`)}}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),K?null:(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,B.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),Q.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,B.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:14,weight:"medium",children:[C.DAY3[e.day]," ",(0,C.fmtH)(e.start),"\u2013",(0,C.fmtH)(e.end)]}),t?(0,B.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,y.autoPost)('all',`Cover needed: ${C.DAY3[e.day]} ${(0,C.fmtH)(e.start)}\u2013${(0,C.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>e.id!==n&&'staff'===e.role).map(t=>(0,B.jsx)(u.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),Q.some(e=>e.staffId===n)?null:(0,B.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,B.jsx)(k.SectionHead,{title:"Holiday & leave"}),p.filter(e=>K||e.staffId===n).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,B.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)((0,b.parseYmd)(e.from))," \u2013 ",(0,b.niceDate)((0,b.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Request leave",K?' (as yourself)':'']}),(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:z,onChangeText:H,style:[u.styles.input,{flex:1}]}),(0,B.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:W,onChangeText:E,style:[u.styles.input,{flex:1}]})]}),(0,B.jsx)(u.Field,{label:"Reason",value:_,onChangeText:q}),(0,B.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(z)||!/^\d{4}-\d{2}-\d{2}$/.test(W)||W{f.useOwner.getState().addLeave({staffId:n,from:z,to:W,reason:_.trim()||'Holiday'}),H(''),E(''),q('')}})]})]}):null,'availability'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",K?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),le.filter(e=>'owner'!==e.role||!K).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{gap:8,children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:30}),(0,B.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,B.jsx)(u.Row,{wrap:!0,gap:4,children:C.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,B.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,$?(0,B.jsx)(N,{init:$,onClose:()=>M(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,C.useCtx)(5e3),x=((0,I.useClockArea)(e=>e.areas[m]),(0,I.areaOf)(m));const j=(0,v.privateClockVenue)(m),[k,y]=(0,l.useState)(!1),O=(0,f.useOwner)(e=>e.consent[a]),R=(0,f.useOwner)(e=>e.attendance),P=(0,f.useOwner)(e=>e.shifts),[z,H]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,F]=(0,l.useState)(null),[N,_]=(0,l.useState)(void 0),[q,K]=(0,l.useState)(null),[U,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=R.filter(t=>t.staffId===a&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,f.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,f.visibleShifts)(P,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,C.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,D.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),F(null),_(void 0);const l=await(0,T.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(K(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&K(null),!0):(F(l.message),_(l.fix),(0,$.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:l.message.split('. ')[0]+'.',body:l.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return O?(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,B.jsx)(S.StaffAvatar,{id:a,size:48}),(0,B.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,B.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,b.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,B.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,C.fmtH)(Z.start)}\u2013${(0,C.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,B.jsx)(c.default,{testID:"clock-area-line",children:(0,B.jsx)(u.T,{size:14,colour:w.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${h.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${h.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ne&&!0===ne.inside&&null!=ne.dist?(0,B.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,B.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,C.hmDur)(te)}):null,J&&Q?(0,B.jsx)(c.default,{testID:"on-break",children:(0,B.jsxs)(u.T,{size:15,weight:"semibold",colour:w.colours.gold,center:!0,children:["On a break since ",(0,b.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,B.jsxs)(B.Fragment,{children:[Q?(0,B.jsx)(u.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,B.jsx)(u.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,B.jsx)(u.Button,{testID:"clock-out",kind:"danger",label:'out'===A?'Checking your location\u2026':'Clock out',disabled:!!A,onPress:()=>{J.breaks?.length?ae('out'):(F(null),H(!0))}})]}):(0,B.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?y(!0):ae('in')}}),J?.breaks?.length?(0,B.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,b.hm)(new Date(e.start))}\u2013${e.end?(0,b.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,B.jsx)(c.default,{testID:"clock-message",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===N?(0,B.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:M.openAppSettings}):null,L&&'location'===N?(0,B.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:M.openLocationSettings}):null,L&&'update'===N?(0,B.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:M.checkAppUpdate}):null]}),ee&&!(0,D.areaSet)(x)?(0,B.jsx)(c.default,{testID:"clock-area-warning",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,B.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,B.jsx)(u.T,{size:14,colour:w.colours.gold,children:"Forgot to clock in or out?"})}),U?(0,B.jsx)(E,{onClose:()=>V(!1)}):null,(0,B.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),q?(()=>{const t=(0,C.paidMins)(q,e);return(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.T,{weight:"semibold",colour:w.colours.gold,children:["Clocked out at ",(0,b.hm)(new Date(q.out))]}),(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,C.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,C.hmDur)(t.paid)]}),(0,B.jsxs)(u.Muted,{children:["In ",(0,b.hm)(new Date(q.in))," \xb7 out ",(0,b.hm)(new Date(q.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",q.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,B.jsx)(u.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,B.jsx)(u.Sheet,{visible:k,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,B.jsxs)(c.default,{style:{gap:12},children:[(0,B.jsxs)(u.T,{children:["We check once that you are at ",h.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,B.jsx)(u.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,B.jsx)(u.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ae('in')}}),(0,B.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),ee?(0,B.jsx)(W,{rid:m,today:t,now:e}):null,G?(0,B.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,B.jsx)(u.Sheet,{visible:z,onClose:()=>H(!1),title:"Did you take a break? If so, how long?",children:(0,B.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,B.jsx)(u.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,B.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,D.breakLabel)(e),disabled:e>=te,onPress:()=>{H(!1),ae('out',{addedBreak:e})}},e))}),(0,B.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{H(!1),ae('out',{breakMins:0})}}),te>360?(0,B.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,B.jsx)(u.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,B.jsx)(c.default,{style:{gap:10},children:(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",h.name,", within about ",x.radius," m."]}),(0,B.jsx)(u.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,B.jsxs)(B.Fragment,{children:[" ",(0,B.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,B.jsx)(u.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",h.name," (within about ",x.radius," m)."]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,B.jsx)(u.Button,{label:"I understand \u2014 continue",onPress:()=>f.useOwner.getState().giveConsent(a,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,C.useCtx)(3e4);return s!=='staff'?(0,B.jsx)(q,{now:e,today:t,meId:n}):(0,B.jsx)(_,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=e(_r(_d[7])),d=e(_r(_d[8])),c=e(_r(_d[9])),u=_r(_d[10]),h=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]),y=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),I=_r(_d[23]),v=_r(_d[24]),D=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),M=_r(_d[28]),O=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]);const z=2650,H=1900,A=e=>e.end-e.start,Y=e=>e>8?.5:e>6?.3333333333333333:0,L=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,C.weekday)(e)),t};function F(e){const{rid:t,r:s,now:n}=(0,C.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,O.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,b.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,b.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,R.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,x.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*z+t.restOfDay.takeaway*H:0})}},[s,a,o,i,r,(0,b.ymd)(e)])}function N({init:e,onClose:t}){const s=(0,f.useOwner)(e=>e.staff),[n,a]=(0,l.useState)(e.shift?.start??12),[o,i]=(0,l.useState)(e.shift?.end??20),[r,d]=(0,l.useState)(e.shift?.breakAt),h=void 0===r||r>n&&rt.id===e.staffId);return(0,B.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,P.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,C.fmtH)(t)}\u2013${(0,C.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{children:"Start"}),(0,B.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:P.SHIFT_MIN_START,max:o-1,onChange:a,format:C.fmtH,label:"Start time"})]}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:"End"}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:P.SHIFT_MAX_END,onChange:i,format:C.fmtH,label:"End time"}),o>=24?(0,B.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,B.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",Y(o-n)?`, ${Math.round(60*Y(o-n))}m planned break`:'']}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,B.jsx)(u.Chip,{label:"Set a break time",onPress:()=>d(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:C.fmtH,label:"Break time"}),(0,B.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,B.jsx)(u.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,B.jsx)(u.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=f.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:h?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&h?{breakAt:r}:{}}),t()}}),(0,B.jsx)(u.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,B.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function W({rid:e,today:t,now:s}){const n=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,f.useOwner)(e=>e.attendance),o=(0,C.useSignedIn)(),{me:i,meId:r}=(0,C.useCtx)(3e4),[d,c]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[p,x]=(0,l.useState)(null),j=d?a.filter(e=>e.staffId===d&&e.in&&!e.out&&s.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!j&&(0,f.isOnBreak)(j),k=s=>{if(!d)return;const a=(0,T.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??i},h);if(!a.ok)return void x(a.message);const l=n.find(e=>e.id===d)?.name??'them';(0,$.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,B.jsx)(u.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,B.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>k(b?'break_end':'break_start')}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>k('out')})]}):(0,B.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>k('in')})}),p?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:p}):null]}):null]})}function E({onClose:e}){const{now:t,today:s,meId:n}=(0,C.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),[r,d]=(0,l.useState)(s),c=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,f.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,l.useState)(c&&!c.out?'out':'in'),[j,k]=(0,l.useState)(h?Math.round(60*h.start):720),[y,S]=(0,l.useState)(h?Math.round(60*h.end):1200),[I,v]=(0,l.useState)(''),[D,T]=(0,l.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,M='out'!==p,O='in'!==p,R=M&&O&&y<=j,P=(e,t)=>(0,B.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return D?(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,B.jsx)(u.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,B.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,B.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,B.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,C.fmtH)(h.start)}\u2013${(0,C.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,b.hm)(new Date(c.in))}\u2013${c.out?(0,b.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,B.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,B.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(k,j)]}):null,O?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(y),y>=1440?' (next day)':'']}),P(S,y)]}):null,R?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:"Clock-out must be after clock-in."}):null,(0,B.jsx)(u.Field,{label:"Note for your manager (optional)",value:I,onChangeText:v,placeholder:"e.g. phone died",maxLength:200}),(0,B.jsx)(u.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{f.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:c?.id,kind:p,suggestedIn:M?(0,m.isoAt)(r,j):void 0,suggestedOut:O?(0,m.isoAt)(r,y):void 0,note:I.trim(),at:t.toISOString()}),T(!0)}})]})}function _(){const{now:e,today:t,meId:s}=(0,C.useCtx)(3e4),n=(0,f.useOwner)(e=>e.attendance),a=(0,f.useOwner)(e=>e.shifts),o=(0,f.useOwner)(e=>e.timeRequests),[i,r]=(0,l.useState)(!1),[d,h]=(0,l.useState)(null),p=(0,b.ymd)(L(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),y=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),S=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),I=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,B.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,B.jsxs)(c.default,{children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,B.jsx)(u.T,{size:28,weight:"bold",colour:w.colours.ok,children:(0,C.hmDur)(y)})]}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"PENDING SIGN-OFF"}),(0,B.jsx)(u.T,{size:18,weight:"semibold",colour:S?w.colours.amber:w.colours.muted,children:(0,C.hmDur)(S)})]})]}),(0,B.jsx)(u.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,B.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),I.length?(0,B.jsx)(k.SectionHead,{title:"My correction requests"}):null,I.map(e=>(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsxs)(u.T,{size:14,children:[(0,b.niceDate)((0,b.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,B.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,b.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,b.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,B.jsx)(k.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,f.shiftOf)((0,f.visibleShifts)(a,!1),t.staffId,t.date),n=(0,C.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,B.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{weight:"semibold",children:(0,b.niceDate)((0,b.parseYmd)(t.date))}),(0,B.jsxs)(u.Muted,{children:[(0,b.hm)(new Date(t.in)),"\u2013",t.out?(0,b.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,C.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,C.fmtH)(s.start)}\u2013${(0,C.fmtH)(s.end)}`:'']})]}),(0,B.jsx)(u.Badge,{kind:(0,m.statusKind)(t),label:'awaiting'===(0,f.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,m.statusLabel)(t)})]}),o?(0,B.jsxs)(u.T,{size:13,colour:w.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,B.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,B.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,B.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,B.jsx)(E,{onClose:()=>r(!1)}):null]})}function q({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,C.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,y]=(0,l.useState)(s),[I,v]=(0,l.useState)(null),[D,T]=(0,l.useState)(!1),$=!!(0,C.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),O=d.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!O.some(t=>t.staffId===e.staffId)),P=d.filter(e=>M.includes(e.date)&&e.out),z=P.filter(f.isConfirmed),H=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),Y=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(z.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=n.find(e=>e.id===t.staffId),a=(0,f.shiftOf)(o,t.staffId,t.date),l=(0,C.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,C.fmtH)(a.start)}-${(0,C.fmtH)(a.end)}`:'-'},${(0,b.hm)(new Date(t.in))},${(0,b.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(r/100).toFixed(2)},${(l.paid/60*r/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,6),selected:x===e,onPress:()=>y(e)},e))}),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,B.jsx)(u.Badge,{kind:"ok",label:`${(0,C.hmDur)(H)} confirmed`})]}),A?(0,B.jsxs)(u.T,{size:13,colour:w.colours.amber,children:[(0,C.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,B.jsxs)(u.Muted,{children:["Labour cost ",(0,j.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,B.jsx)(a.WideTable,{children:(0,B.jsxs)(c.default,{style:{gap:2},children:[(0,B.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:w.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,B.jsx)(u.T,{size:12,weight:"semibold",colour:w.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),O.map(t=>{const i=n.find(e=>e.id===t.staffId),l=(0,f.shiftOf)(o,t.staffId,x),d=(0,C.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,B.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,B.jsx)(S.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,B.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,B.jsx)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:l?`${(0,C.fmtH)(l.start)}\u2013${(0,C.fmtH)(l.end)}`:'\u2013'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:(0,b.hm)(new Date(t.in))}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,b.hm)(new Date(t.out)):'on'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,B.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,C.hmDur)(d.paid):`${(0,C.hmDur)(d.worked)}\u2026`}),(0,B.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?w.colours.ok:'open'===(0,f.attStatus)(t)?w.colours.blue:w.colours.amber,children:(0,m.statusLabel)(t)}),(0,B.jsx)(u.T,{size:11,style:{width:140},colour:c.length?w.colours.amber:w.colours.ok,children:c.join(', ')||'OK'}),(0,B.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>v(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,B.jsx)(u.T,{size:12,colour:w.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,B.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,B.jsxs)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:[(0,C.fmtH)(t.start),"\u2013",(0,C.fmtH)(t.end)]}),(0,B.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?w.colours.muted:w.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),O.length||R.length?null:(0,B.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,B.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,B.jsx)(k.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)(new Date(e.at))," ",(0,b.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,B.jsx)(u.Muted,{children:"No manual changes yet."}),I?(0,B.jsx)(m.OverrideSheet,{a:I,staffId:I.staffId,date:I.date,onClose:()=>v(null)}):null,(0,B.jsxs)(u.Sheet,{visible:D,onClose:()=>T(!1),title:"Payroll export",children:[(0,B.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,C.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,B.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,B.jsx)(u.T,{size:10,colour:t?w.colours.text:w.colours.gold,children:e},t)),L.length>14?(0,B.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,B.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1009,[868,877,998,1338,1151,1152,30,263,151,127,813,819,856,1342,1029,870,816,818,821,1018,999,927,953,1207,988,954,1103,947,1290,1305,1303,1030,24]);
+__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return C}}),_e.allocate=S,_e.Tips=function({go:e}={}){const{rid:w,now:M,today:v,role:$,meId:P,me:B}=(0,x.useCtx)(6e4),I=(0,a.useOwner)(e=>e.staff),R=(0,a.useOwner)(e=>e.attendance),A=(0,a.useOwner)(e=>e.shifts),F=(0,a.useOwner)(e=>e.tronc),D=(0,a.useOwner)(e=>e.troncCash),E=(0,a.useOwner)(e=>e.troncHistory),z=(0,a.useOwner)(e=>e.troncLog),L=(0,d.useOrders)(w),q=(0,f.useVenuePay)(w).pay,[V,N]=(0,n.useState)(-1),[H,_]=(0,n.useState)(''),[Y,K]=(0,n.useState)(!1),[W,U]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(F.text),[J,X]=(0,n.useState)(null),Z='staff'!==$,ee='owner'===$,{s:te,e:se,key:oe}=(0,f.venueRange)(q,'tips',V,M),ne=`${(0,u.niceDate)(te)} \u2013 ${(0,u.niceDate)(se)} ${se.getFullYear()}`,ie=E.find(e=>e.key===oe),re=e=>a.useOwner.getState().setOwner({tronc:{...F,...e}}),le=(0,j.useSync)(e=>!!e.venueId&&'guest'!==e.kind),de=Math.round((se.getTime()-te.getTime())/864e5)+1,ae=(0,n.useMemo)(()=>{let e=L.filter(e=>e.createdAt.slice(0,10)>=(0,u.ymd)(te)&&e.createdAt.slice(0,10)<=(0,u.ymd)(se)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!le)for(let t=0;tM)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,y.hash)((0,u.ymd)(s)+'tip')))}return e},[oe,L.length,le]),ce=D[oe]??0,ue=ie?ie.pot:ae+ce,he=(0,n.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,u.ymd)(s);I.forEach(t=>{const s=R.filter(e=>e.staffId===t.id&&e.date===o&&e.out),n=s.filter(a.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0),i=s.filter(e=>!(0,a.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0);(n||i)&&(e[t.id]={paid:(e[t.id]?.paid??0)+n,est:(e[t.id]?.est??!1)||i>0})})}return e},[oe,R.length,A.length,I.length]),pe=I.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&F.includeManagers||'owner'===e.role&&F.includeOwner)),me=(0,n.useMemo)(()=>{if(ie)return ie.rows;const e=pe.map(e=>{const t=(he[e.id]?.paid??0)/60,s=F.points[C(e)]??1;return'hours'===F.method?t:'points'===F.method?t*s:'equal'===F.method?t>0?1:0:F.custom[e.id]??0}),{amounts:t}=S(ue,e),s=e.reduce((e,t)=>e+t,0);return pe.map((o,n)=>({staffId:o.id,hours:(he[o.id]?.paid??0)/60,points:F.points[C(o)]??1,pct:s?e[n]/s*100:0,amount:t[n]}))},[ie,pe.map(e=>e.id).join(),he,F,ue]),ge=me.reduce((e,t)=>e+t.amount,0),xe=ie?0:(()=>{const e=me.map(e=>e.pct);return S(ue,e).remainder})(),fe=Object.entries(F.custom).filter(([e])=>pe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ye='custom'===F.method&&Math.abs(fe-100)>.01,je=new Date(se.getFullYear(),se.getMonth()+2,0),we=[...E].sort((e,t)=>t.end.localeCompare(e.end))[0],be=0!==E.length&&(0,u.parseYmd)(we.end)<(0,u.addMins)(M,-89280),Te=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(me.map(e=>{const t=I.find(t=>t.id===e.staffId);return`${k(t.name)},${C(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return Z?(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsxs)(l.Card,{highlight:h.colours.gold,children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,b.jsx)(l.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>N(V-1)}),(0,b.jsxs)(r.default,{style:{alignItems:'center',flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:ne}),ie?(0,b.jsx)(l.Badge,{kind:"ok",label:`Approved & locked ${ie.lockedAt}`}):V>=0?(0,b.jsx)(l.Badge,{kind:"amber",label:"Period in progress"}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:V>=0,onPress:()=>N(V+1)})]}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Tip pot"}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Card tips on orders"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.card:ae)})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Cash tips"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.cash:ce)})]}),ie?null:(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:H,onChangeText:_,style:[l.styles.input,{flex:1}]}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(H)>=0)||''===H.trim(),onPress:()=>{a.useOwner.getState().setOwner({troncCash:{...D,[oe]:Math.round(100*Number(H))}}),_('')}})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"bold",children:"Total pot"}),(0,b.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(ue)})]}),(0,b.jsx)(l.Muted,{children:le?'Card tips are the tips taken on orders in CoverCharge. Add cash tips above.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ie?(0,b.jsxs)(l.Muted,{children:["Locked with method: ",T[ie.method],"."]}):(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,b.jsx)(l.Chip,{label:T[e],selected:F.method===e,onPress:()=>ee&&re({method:e})},e))}),ee?null:(0,b.jsx)(l.Muted,{children:"Only the owner can change the policy."}),'points'===F.method?Object.entries(F.points).map(([e,t])=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:e}),(0,b.jsx)(l.Row,{gap:6,children:(0,b.jsx)(l.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ee&&re({points:{...F.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===F.method?(0,b.jsxs)(b.Fragment,{children:[pe.map(e=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{style:{flex:1},children:k(e.name)}),(0,b.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(F.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>re({custom:{...F.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&re({custom:{...a.useOwner.getState().tronc.custom,[e.id]:s}})},style:[l.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,b.jsxs)(l.T,{size:13,colour:ye?h.colours.red:h.colours.ok,children:["Total ",fe.toFixed(1),"%",ye?' (must be 100%)':' \u2713']})]}):null,(0,b.jsx)(l.Toggle,{label:"Include managers",value:F.includeManagers,onChange:e=>ee&&re({includeManagers:e})}),(0,b.jsx)(l.Toggle,{label:"Include owner",value:F.includeOwner,onChange:e=>ee&&re({includeOwner:e})}),F.includeOwner?(0,b.jsx)(l.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),(0,b.jsx)(i.default,{horizontal:!0,children:(0,b.jsxs)(r.default,{children:[(0,b.jsx)(l.Row,{gap:0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,b.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),me.map(e=>{const t=I.find(t=>t.id===e.staffId);return(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,b.jsxs)(l.T,{size:13,style:{width:130},numberOfLines:1,children:[k(t?.name),he[e.staffId]?.est&&!ie?'*':'']}),(0,b.jsx)(l.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,b.jsx)(l.T,{size:13,style:{width:54},children:'points'===F.method||'points'===ie?.method?e.points.toFixed(1):'\u2013'}),(0,b.jsxs)(l.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,b.jsx)(l.T,{size:13,weight:"semibold",style:{width:80},children:(0,c.gbp)(e.amount)})]},e.staffId)}),(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6},children:[(0,b.jsx)(l.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,b.jsx)(l.T,{size:13,weight:"bold",colour:ge===ue?h.colours.ok:h.colours.red,style:{width:80},children:(0,c.gbp)(ge)})]})]})}),(0,b.jsxs)(l.Muted,{children:[ge===ue?`\u2713 Total equals the pot (${(0,c.gbp)(ue)}).`:'\u2717 Total does not equal the pot.',xe?` Rounding: ${xe}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ie?null:(0,b.jsx)(l.Button,{label:"Approve & lock period",disabled:!ee||V>=0||ye||ge!==ue||ue<=0,onPress:()=>{const e=`${(0,u.niceDate)(M)} ${M.toTimeString().slice(0,5)}`,t={id:`tp-${oe}`,key:oe,label:ne,end:(0,u.ymd)(se),pot:ue,card:ae,cash:ce,method:F.method,rows:me,lockedAt:e,by:B};a.useOwner.getState().setOwner({troncHistory:[t,...E],troncLog:[{id:`tl-${Date.now()}`,at:M.toISOString(),text:`${B} approved & locked tips for ${ne}: ${(0,c.gbp)(ue)} split ${T[F.method].toLowerCase()} between ${me.filter(e=>e.amount>0).length} staff`},...z]})}}),!ie&&V>=0?(0,b.jsx)(l.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ee||ie?null:(0,b.jsx)(l.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),ie?(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:ie.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ie.shared,onPress:()=>{(0,p.autoPost)('all',`Tips for ${ne} approved: ${(0,c.gbp)(ie.pot)} shared between ${ie.rows.filter(e=>e.amount>0).length} staff. See your own share in Team \u203a Tips.`),a.useOwner.getState().setOwner({troncHistory:E.map(e=>e.id===ie.id?{...e,shared:(0,u.niceDate)(M)}:e)}),X('Posted to All staff chat. Demo, nothing is sent.')}}):null]}),J?(0,b.jsx)(l.Banner,{kind:"demo",title:J}):null,(0,b.jsx)(m.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,b.jsxs)(l.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,c.gbp)(ue)} = allocated ${(0,c.gbp)(ge)}`],[F.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!be,'Tips allocated by the end of the following month',`This period: by ${(0,u.niceDate)(je)} ${je.getFullYear()}`],[!0,'Tip records kept for 3 years',`${E.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${z.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,b.jsxs)(l.Row,{style:{alignItems:'flex-start'},children:[(0,b.jsx)(l.T,{colour:e?h.colours.ok:h.colours.red,children:e?'\u2713':'\u2717'}),(0,b.jsxs)(r.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{size:14,children:t}),(0,b.jsx)(l.Muted,{children:s})]})]},String(t))),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{Q(F.text),U(!0)}})]}),(0,b.jsx)(m.SectionHead,{title:"Tip history & audit log"}),E.map(e=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",children:(0,c.gbp)(e.pot)})]}),(0,b.jsxs)(l.Muted,{children:[T[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),z.map(e=>(0,b.jsxs)(l.Muted,{children:[(0,u.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),E.length||z.length?null:(0,b.jsx)(l.Muted,{children:"No approved periods yet."}),(0,b.jsxs)(l.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,b.jsx)(l.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,b.jsx)(r.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Te.map((e,t)=>(0,b.jsx)(l.T,{size:11,colour:t?h.colours.text:h.colours.gold,children:e},t))}),(0,b.jsxs)(l.Muted,{children:[ne," \xb7 ",T[ie?.method??F.method]]})]}),(0,b.jsxs)(l.Sheet,{visible:W,onClose:()=>U(!1),title:"Tipping policy",children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ee,value:G,onChangeText:Q,style:[l.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ee?(0,b.jsx)(l.Button,{label:"Save policy",onPress:()=>{re({text:G}),U(!1)}}):null,(0,b.jsx)(l.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,b.jsx)(O,{})},_e.MyTips=O;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),l=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),b=_r(_d[19]);const T={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},C=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',k=e=>(e??'').replace(' (example)','');function S(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),n=o.map(Math.floor);let i=e-n.reduce((e,t)=>e+t,0);const r=i;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{i>0&&(n[e]+=1,i-=1)}),{amounts:n,remainder:r}}function O({staffId:e}={}){const t=(0,x.useCtx)(6e4),{now:s,me:o}=t,i=e??t.meId,d=(0,a.useOwner)(e=>e.tronc),u=(0,a.useOwner)(e=>e.troncHistory),p=(0,a.useOwner)(e=>e.troncLog),[m,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(null),C=u.flatMap(e=>e.rows.filter(e=>e.staffId===i).map(t=>({h:e,r:t})));return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(w.TipGoalCard,{staffId:i}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"My tips"}),(0,b.jsx)(l.Muted,{children:"Only your own tip history is shown. 100% of tips go to staff; nothing is deducted."})]}),C.map(({h:e,r:t})=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(t.amount)})]}),(0,b.jsxs)(l.Muted,{children:[(0,x.hmDur)(Math.round(60*t.hours))," paid \xb7 ",t.pct.toFixed(1),"% share \xb7 ",T[e.method]," \xb7 approved ",e.lockedAt]})]},e.id)),C.length?null:(0,b.jsx)(l.Muted,{children:"No approved tip periods yet. (Preview: approve a period in the Owner view first.)"}),(0,b.jsx)(l.Button,{kind:"secondary",label:"Request my tip records",onPress:()=>{a.useOwner.getState().setOwner({troncLog:[{id:`tl-${Date.now()}`,at:s.toISOString(),text:`${o} requested their tip records`},...p]}),j('Request logged for your manager (demo, nothing is sent).')}}),y?(0,b.jsx)(l.Banner,{kind:"success",title:y}):null,(0,b.jsx)(l.Button,{kind:"ghost",label:"Read the tipping policy",onPress:()=>f(!0)}),(0,b.jsx)(l.Sheet,{visible:m,onClose:()=>f(!1),title:"Tipping policy",children:(0,b.jsx)(l.T,{size:14,children:d.text})})]})}},1010,[868,877,833,30,151,127,813,819,856,816,818,821,999,1018,927,1111,1301,820,1341,24]);
+__d(function(g,r,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:n,app:d,seeAll:h}){const p=(0,l.useSafety)(e=>e.accidents),[y,b]=(0,s.useState)(h?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,u.jsxs)(a.default,{style:{gap:12},testID:"accident-book",children:[(0,u.jsx)(c.Tabs,{value:y,onChange:b,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:h?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,u.jsx)(x,{me:e,meId:t,now:n,app:d,onSaved:()=>b('list')}):null,'list'===y?(0,u.jsxs)(c.Box,{testID:"accident-list",children:[(h?p:w).length?(h?p:w).map(e=>(0,u.jsx)(j,{a:e,manager:h},e.id)):(0,u.jsx)(o.Muted,{children:"No entries yet."}),!h&&f>0?(0,u.jsx)(a.default,{testID:"accident-others",children:(0,u.jsxs)(o.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,u.jsx)(o.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=e(r(_d[2])),a=e(r(_d[3])),o=r(_d[4]),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=e=>String(e).padStart(2,'0'),p=e=>`${e.getFullYear()}-${h(e.getMonth()+1)}-${h(e.getDate())}T${h(e.getHours())}:${h(e.getMinutes())}`,y=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${h(t.getHours())}:${h(t.getMinutes())}`};function x({me:e,meId:n,now:h,app:y,onSaved:x}){const[j,b]=(0,s.useState)({date:p(h).slice(0,10),time:p(h).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[w,f]=(0,s.useState)(''),[T,D]=(0,s.useState)(''),I=e=>b({...j,...e}),S='Near miss'===j.category,C=(e,s,n,l=!1)=>(0,u.jsxs)(a.default,{style:{gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:e}),(0,u.jsx)(t.TextInput,{accessibilityLabel:e,value:String(j[s]),onChangeText:e=>I({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:l,style:[o.styles.input,l&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,u.jsxs)(c.Box,{testID:"accident-form",children:[(0,u.jsx)(o.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsxs)(a.default,{style:{flex:1,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Date"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Date",value:j.date,onChangeText:e=>I({date:e}),placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[o.styles.input,{minWidth:0,width:40}]})]}),(0,u.jsxs)(a.default,{style:{width:110,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Time"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Time",value:j.time,onChangeText:e=>I({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:o.styles.input})]})]}),(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"What kind?"}),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:l.ACCIDENT_CATEGORIES.map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.category===e,onPress:()=>I({category:e})},e))}),C('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),C('Person involved','person','Name'),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.personType===e,onPress:()=>I({personType:e})},e))}),C('What happened','what','Describe what happened, in order',!0),C('Injury','injury',S?'None (near miss)':'e.g. small cut to left thumb'),C('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),C('Witnesses','witnesses','Names, or none'),C('Reported by','reportedBy','Your name'),w?(0,u.jsx)(o.Banner,{kind:"warn",children:w}):null,(0,u.jsx)(o.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(j.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(j.time)?j.category?j.location.trim()&&j.person.trim()&&j.what.trim()?(l.useSafety.getState().addAccident({when:`${j.date}T${j.time}`,location:j.location.trim(),person:j.person.trim(),personType:j.personType,category:j.category,what:j.what.trim(),injury:j.injury.trim()||(S?'None (near miss)':'Not recorded'),firstAid:j.firstAid.trim()||'None recorded',witnesses:j.witnesses.trim()||'None',reportedBy:j.reportedBy.trim()||e,reportedById:n,app:y}),D(`Saved to the accident book: ${j.category}, ${j.location.trim()}.`),f(''),b({...j,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void x()):f('Fill in where it happened, who was involved and what happened.'):f('Pick what kind of accident or near miss it was.'):f('Enter the date as YYYY-MM-DD and the time as HH:MM.')}),T?(0,u.jsx)(a.default,{testID:"accident-saved",children:(0,u.jsx)(o.T,{size:14,colour:d.colours.ok,children:T})}):null,(0,u.jsx)(o.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function j({a:e,manager:c}){const h=l.RIDDOR_CATEGORIES.includes(e.category),[p,x]=(0,s.useState)(e.riddorNote??''),[j,b]=(0,s.useState)(!1);return(0,u.jsxs)(a.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:d.colours.border,gap:4},children:[(0,u.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(o.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,u.jsx)(o.Badge,{kind:'Near miss'===e.category?'blue':h?'red':'amber',label:'Near miss'===e.category?'Near miss':h?'Serious':'Accident'})]}),(0,u.jsxs)(o.Muted,{children:[y(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||c?(0,u.jsxs)(a.default,{style:{gap:2},children:[(0,u.jsxs)(o.T,{size:14,children:["What happened: ",e.what]}),(0,u.jsxs)(o.T,{size:14,children:["Injury: ",e.injury]}),(0,u.jsxs)(o.T,{size:14,children:["First aid: ",e.firstAid]}),(0,u.jsxs)(o.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,c&&h?(0,u.jsxs)(a.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,u.jsx)(o.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,u.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:x,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:o.styles.input}),(0,u.jsx)(o.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>l.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,u.jsxs)(o.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1011,[877,30,263,127,813,1105,821,1340,24]);
+__d(function(g,_r,_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=v,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s}){const[o,l]=(0,i.useState)('today'),r=(e,t)=>({id:e,label:t}),u='chef'===s?[r('today','Today'),r('units','Fridges & units'),r('record','Quick entry'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:'managers'===s?[r('today','Today'),r('units','Fridges & units'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:[r('today','Today'),r('record','Quick entry'),r('diary','Diary'),r('history','My entries')],h={me:e,meId:t,now:n,mode:s};return(0,y.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,y.jsx)(v,{mode:s,now:n,onPress:()=>l('today')}):null,(0,y.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,y.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,y.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(C,{who:h}),(0,y.jsx)(T,{who:h})]}):null,'diary'===o?(0,y.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,y.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,y.jsx)(b.ReportView,{who:h}):null,'history'===o?(0,y.jsx)(S,{who:h}):null,'limits'===o?(0,y.jsx)(I,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,y.jsx)(B,{mode:s,me:e,now:n}):null,(0,y.jsx)(c.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. Sections follow Safer Food, Better Business (cross-contamination, cleaning, chilling, cooking, management). Your own HACCP plan (e.g. CookSafe) sets the limits that count. Saved on this device."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=e(_r(_d[5])),r=e(_r(_d[6])),d=e(_r(_d[7])),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]);const f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),j=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),w=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function v({now:e,onPress:t,mode:s="managers"}){const o=(0,n.useSafetyView)(s).points,i=(0,n.useSafetyView)(s).entries,l=(0,h.missedChecks)(o,i,e);if(!l.length)return(0,y.jsx)(d.default,{testID:"haccp-uptodate",children:(0,y.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,y.jsx)(d.default,{testID:"haccp-missed",children:(0,y.jsx)(c.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,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function k(e,t){u.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,s.chefCanSee)(o.useOwner.getState().site,t.point)).map(t=>{const n=(0,h.isTempKind)(t.point.kind)?(0,h.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,h.initialsOf)(e.me)}}))}function C({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,f]=(0,i.useState)(null),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(!1),[S,D]=(0,i.useState)(!1),I=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return f(null),void v('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);D(n),v(''),f(i.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,h.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},R=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),B=(b??[]).map(e=>{const t=l.find(t=>t.id===e.pointId),n=w(e.value),s=!!t&&(0,h.isTempKind)(t.kind),o=!!t&&(s?null!=n:void 0!==e.done),i=t?s?null!=n?(0,h.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:o,ok:i,needsAction:!1===i&&!e.corrective.trim()}}),L=B.length>0&&B.every(e=>e.ready&&!e.needsAction);return(0,y.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,y.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:u,onChangeText:m,placeholder:"walk-in fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>P(u,!1),style:[c.styles.input,{flex:1,minWidth:0,width:40}]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void v("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(C)return void I.current?.stop();const t=new e;I.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';m(t),t&&P(t,!0)},t.onerror=()=>v("Didn't catch that. Try again or type the readings."),t.onend=()=>T(!1);try{t.start(),T(!0)}catch{v("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:C?p.colours.gold:'transparent'},children:(0,y.jsx)(c.T,{size:20,children:C?'\u25a0':'\ud83c\udfa4'})})]}),(0,y.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,y.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,y.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,y.jsxs)(c.T,{weight:"semibold",children:["Check these ",b.length," reading",1===b.length?'':'s']}),B.map(({d:e,point:n,temp:s,ok:o,needsAction:i})=>(0,y.jsxs)(d.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===o?p.colours.red:p.colours.border,backgroundColor:p.colours.surface2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key)),children:(0,y.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,y.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,y.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${n.name}`,value:e.value,onChangeText:t=>R(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:96,fontSize:20}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,y.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,y.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,y.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${n.name}`,value:e.corrective,onChangeText:t=>R(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[c.styles.input,i&&{borderColor:p.colours.red}]}):null,i?(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{k(e,B.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:S?'voice':'typed'}))),v(`Saved ${B.length} reading${1===B.length?'':'s'}.`),f(null),m('')},style:{flex:1}}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),v('Nothing saved.')}})]}),(0,y.jsx)(c.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function T({who:e}){const s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)(s[0]?.id),[r,d]=(0,i.useState)(''),[u,m]=(0,i.useState)(),[b,f]=(0,i.useState)(''),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(''),S=s.find(e=>e.id===o),D=!!S&&(0,h.isTempKind)(S.kind),I=w(r),P=S?D?null==I?null:(0,h.inRange)(S,I):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,y.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),f(''),T('')}},e.id))}),S?(0,y.jsxs)(c.Muted,{children:[h.KIND_LABEL[S.kind]," \xb7 safe: ",(0,h.limitText)(S)]}):null,D?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:r,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:110,fontSize:22}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,y.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.Banner,{kind:"danger",title:D?'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,y.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:f,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:v,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{k(e,[{point:S,value:D?I:void 0,done:D?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),f(''),v(''),T(`Saved: ${S.name}.`)}}),C?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:C}):null]})}function S({who:e}){const t=(0,n.useSafetyView)(e.mode).entries,s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)('7'),[r,u]=(0,i.useState)('all'),[m,b]=(0,i.useState)(!1),[f,j]=(0,i.useState)(''),w='staff'===e.mode,v=(0,i.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=>!(w&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==r&&t.kind!==r||m&&t.ok))},[t,o,r,m,w,e.meId,e.now.getTime()]),k=Array.from(new Set(s.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,y.jsxs)(x.Box,{testID:"haccp-history",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,y.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,y.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,y.jsx)(d.default,{testID:"haccp-count",children:(0,y.jsxs)(c.Muted,{children:[v.length," entr",1===v.length?'y':'ies',v.filter(e=>!e.ok).length?` \xb7 ${v.filter(e=>!e.ok).length} out of range`:'']})}),v.length?v.slice(0,200).map(e=>(0,y.jsx)(D,{e:e},e.id)):(0,y.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,y.jsx)(c.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!v.length,onPress:()=>j((0,x.downloadText)(`food-safety-log-${C}.csv`,(0,h.toCsv)(v,s))?`CSV downloaded: ${v.length} entries.`:'Downloads work in the web app.')}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!v.length,onPress:()=>j((0,x.printTable)('Food safety log (HACCP)',`${v.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,h.LOG_HEAD,(0,h.logRows)(v,s))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),f?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:f}):null]})}function D({e:e}){return(0,y.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,y.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,y.jsxs)(c.Muted,{style:{flex:1},children:[j(e.at)," ",f(e.at)," \xb7 ",e.initials??(0,h.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,y.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,y.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,y.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function I({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,y.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,y.jsx)(c.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.'}),s.map(t=>(0,y.jsx)(P,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,y.jsx)(R,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function P({p:e,editable:n,onSaved:s}){const[o,l]=(0,i.useState)(null==e.min?'':String(e.min)),[r,m]=(0,i.useState)(null==e.max?'':String(e.max)),[x,b]=(0,i.useState)(e.due.join(', ')),f=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),v=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=w(o))&&(''===r||null!=w(r));return n?(0,y.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,y.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[f?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,y.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:r,onChangeText:m,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:x,onChangeText:b,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[c.styles.input,{flex:1,minWidth:140,width:40}]}),v?(0,y.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:w(o),max:''===r?void 0:w(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,y.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,y.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function R({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,y.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,y.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,y.jsx)(c.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,s.chefCanSee)(o.useOwner.getState().site,n),onPress:()=>{if(!(0,s.chefCanSee)(o.useOwner.getState().site,n))return;const t='fridge'===r?{max:5}:'freezer'===r?{max:-18}:'cook'===r?{min:75}:'hothold'===r?{min:63}:'cool'===r||'delivery'===r?{max:8}:{};u.useSafety.getState().addPoint({name:n.trim(),kind:r,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),l('')}})]})}function B({me:e,now:l,mode:r}){const h=(0,n.useSafetyView)(r).probes??[],m=(0,n.useSafetyView)(r).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[b,f]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,T]=(0,i.useState)(null),[S,D]=(0,i.useState)(''),I=m.find(e=>e.id===v);return(0,y.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,y.jsx)(c.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."}),h.length?h.map(e=>(0,y.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,y.jsx)(c.T,{weight:"semibold",children:e.name}),(0,y.jsx)(c.Muted,{children:e.location})]}),(0,y.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>T(C===e.id?null:e.id)}),(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>u.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,y.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,y.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,y.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,y.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>D(`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,y.jsx)(d.default,{testID:"probes-empty",children:(0,y.jsx)(c.Muted,{children:"No probes yet."})}),S?(0,y.jsx)(d.default,{testID:"probe-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:S})}):null,b?(0,y.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:j,onChangeText:w,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[c.styles.input,{minWidth:0}]}),(0,y.jsx)(c.Muted,{children:"Where is it?"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!I,onPress:()=>{j.trim()&&I&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,I))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:I.id,location:I.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),D(`Added \u201c${j.trim()}\u201d for ${I.name}. Next: connect your probe.`),w(''),k(''),f(!1))}}),(0,y.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>f(!1)})]})]}):(0,y.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{f(!0),D('')}}),(0,y.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1012,[877,1345,1024,856,30,196,263,127,813,1105,1113,821,953,1340,1346,24]);
+__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=p,_e.pickPhoto=b,_e.AvatarMaker=function({meId:e,me:h}){const u=(0,n.useAvatars)(t=>t.photos[e]),[g,f]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[w,I]=(0,t.useState)(!1),[k,P]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g)},[g]);const M='undefined'!=typeof document,R=async e=>{P('');const t=await b(e);if(t){I(!0),j(!1);try{const e=await p(t);g&&URL.revokeObjectURL(g),f(URL.createObjectURL(t)),y(e)}catch{P("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{I(!1)}}},S=()=>{g&&URL.revokeObjectURL(g),f(null),y(null),j(!1)},B=h.replace(' (example)','');return(0,c.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,c.jsxs)(d.Box,{children:[(0,c.jsxs)(s.Row,{gap:14,children:[(0,c.jsx)(l.StaffAvatar,{id:e,size:88}),(0,c.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,c.jsxs)(s.Muted,{children:[u?`Your avatar from a photo (made ${new Date(u.at).toLocaleDateString('en-GB')}).`:'Your default space-age avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),u?(0,c.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{n.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),P('Back to your default avatar.')}}):null]}),(0,c.jsxs)(d.Box,{testID:"avatar-create",children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,c.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),M?v?(0,c.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,c.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[g?(0,c.jsx)(a.default,{source:{uri:g},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,c.jsx)(s.Muted,{children:"Your photo"})]}),(0,c.jsx)(s.T,{size:22,colour:i.colours.gold,children:"\u2192"}),(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,c.jsx)(a.default,{source:{uri:v},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:i.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,c.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,c.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:x},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>j(!x),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:x?i.colours.gold:i.colours.border},children:[(0,c.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:i.colours.gold,backgroundColor:x?i.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:x?(0,c.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,c.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!x,onPress:()=>{const t=n.useAvatars.getState().setOwn(e,e,v,B);P(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&S()}}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:S})]})]}):(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:w?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:w,onPress:()=>R(!1)}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:w,onPress:()=>R(!0)})]}):(0,c.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,c.jsx)(o.default,{testID:"avatar-msg",children:(0,c.jsx)(s.T,{size:14,colour:i.colours.ok,children:k})}):null,(0,c.jsx)(s.Banner,{kind:"info",title:"Coming soon: AI avatars",children:"A future version will use AI to draw you as a full cartoon in the same style. For now it's a simple filter that runs on your phone."})]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]);const h=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),u=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function g(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function f(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function p(e){const{img:t,url:a}=await g(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),c=d[Math.floor(.04*d.length)],g=d[Math.floor(.96*d.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1013,[30,196,122,263,127,813,953,1201,821,1340,24]);
+__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1014,[]);
+__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1015,[]);
+__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1016,[863,820,1015]);
+__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(c,o){const f=s.useSync.getState().venueId;if(!f)return{ok:!1,error:'Not connected. Try again when the app is online.'};const u=(0,t.getSupabase)();try{const{data:t}=await u.from('staff').select('id').eq('venue_id',f).eq('external_ref',c).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await u.rpc('set_staff_cash_up',{p_staff:t.id,p_on:o});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[c]:o}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const c=(0,t.getSupabase)();try{const[{data:t},{data:s}]=await Promise.all([c.rpc('my_cash_up_access',{p_venue:r}),c.from('staff').select('external_ref, can_cash_up').eq('venue_id',r)]),o={};if(Array.isArray(s))for(const t of s)t.external_ref&&(o[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?o:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1017,[863,820,996]);
+__d(function(g,_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,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return a}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,r){const t=e.hours.filter(r=>!e.nextHour||r.hour>=e.nextHour.hour).reduce((e,r)=>!e||r.covers>e.covers?r:e,void 0);return{level:b(t?.covers??0,r.settings.capacityPerHour),peak:t}},_e.Tile=function({label:e,value:n,sub:c,onPress:u,accent:d,children:a}){const b=(0,s.jsxs)(t.default,{style:{flexGrow:1,flexBasis:150,backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{size:13,weight:"medium",colour:o.colours.muted,children:e}),(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}),c?(0,s.jsx)(l.T,{size:13,colour:o.colours.muted,children:c}):null,a]});return u?(0,s.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:e,onPress:u,style:{flexGrow:1,flexBasis:150},children:b}):b},_e.SectionHead=function({title:e,right:r,sub:n}){return(0,s.jsxs)(t.default,{style:{gap:2,marginTop:6},children:[(0,s.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,children:e}),r]}),n?(0,s.jsx)(l.Muted,{children:n}):null]})},_e.AlertBox=function({colour:e,title:r,children:n}){return(0,s.jsxs)(t.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:r}),n]})},_e.Bars=function({data:e,max:r,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const u=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(t.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(t.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(t.default,{style:{height:Math.max(0,e.b/r*c),backgroundColor:u?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(t.default,{style:{height:Math.max(d?2:0,e.a/r*c),backgroundColor:u?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return f}}),_r(_d[0]);var r=e(_r(_d[1])),t=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,u=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const a=e=>!['collected','served','closed','cancelled'].includes(e.status);function b(e,r){const t=r?e/r:0;return t<.35?{label:'Quiet',colour:o.colours.ok,pct:t}:t<.6?{label:'Steady',colour:o.colours.blue,pct:t}:t<.85?{label:'Busy',colour:o.colours.amber,pct:t}:{label:'Very busy',colour:o.colours.red,pct:t}}const f=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1018,[30,263,127,813,821,5,24]);
+__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1019,[30,813,819,822,24]);
+__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.requestChallenge=async function(t,s){const{data:u,error:o}=await n().rpc('venue_request_challenge',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s});if(o)throw o;return u},_e.sendVenueRequest=async function(t,s,u,o,c,l){const{data:_,error:p}=await n().rpc('submit_venue_request',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s,p_payload:u,p_challenge:o,p_answer:c,p_website:l});if(p)throw p;return _},_e.listVenueRequests=async function(e,t){const{data:s,error:u}=await n().from('venue_booking_requests').select('*').eq('venue_id',e).eq('kind',t).order('status',{ascending:!1}).order('created_at',{ascending:!1}).limit(100);if(u)throw u;return s||[]},_e.decideVenueRequest=async function(e,t){const{data:s,error:u}=await n().rpc('decide_venue_request',{p_id:e,p_decision:t});if(u)throw u;return s},Object.defineProperty(_e,"requestMessage",{enumerable:!0,get:function(){return s}});var e=r(d[0]),t=r(d[1]);const n=()=>(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},1020,[6,863]);
+__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1021,[809,30,873,872,1240,1114,831,1094]);
+__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1022,[1025]);
+__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=D,_e.TimeGrid=v,_e.ScopePicker=I,_e.BlockNowSheet=B,_e.DatePicker=C,_e.AddBlockSheet=P,_e.FutureBlocksList=R,_e.BlocksScreen=L,_e.DisplayBlocksScreen=W,_e.DisplayBlocksMenu=function({rid:e,r:t,now:o,by:l,onClose:n}){const[a,i]=(0,s.useState)('menu');return'now'===a?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'future'===a?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'list'===a?(0,y.jsx)(W,{rid:e,r:t,now:o,by:l,onBack:n}):(0,y.jsxs)(m.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,y.jsx)(D,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>i('now')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>i('future')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>i('list')}),(0,y.jsx)(m.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=e(_r(_d[4])),a=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),r=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),y=_r(_d[18]);const k=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],w=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=e=>{try{o.default.announceForAccessibility?.(e)}catch{}};function D({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:a,a11y:i,wide:d}){return(0,y.jsxs)(n.default,{testID:a,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:d?void 0:84,flexGrow:d?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?b.colours.gold:b.colours.border,backgroundColor:o?b.colours.gold:e?b.colours.goldTint:b.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:o?b.colours.onGold:b.colours.goldLight,center:!0,children:e}),t?(0,y.jsx)(m.T,{size:13,colour:o?b.colours.onGold:b.colours.muted,center:!0,children:t}):null]})}function v({from:e,to:t,min:o,max:l,onChange:n,testID:a="time-grid"}){const[d,r]=(0,s.useState)(e?'to':'from'),c=(0,u.quarterTimes)(o,l),g=t=>{if('from'===d||!e||(0,h.toMins)(t)<=(0,h.toMins)(e))return n(t,void 0),r('to'),void j(`From ${(0,u.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),j(`Block ${(0,u.rangeText)(e,t)}`)};return c.length?(0,y.jsxs)(i.default,{testID:a,style:{gap:6},children:[(0,y.jsxs)(m.T,{size:15,weight:"semibold",colour:b.colours.gold,children:['from'!==d&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,u.rangeText)(e,t??e)}`:'']}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,h.toMins)(s)>=(0,h.toMins)(e)&&(0,h.toMins)(s)<=(0,h.toMins)(t);return(0,y.jsx)(D,{testID:`${a}-${s.replace(':','')}`,label:(0,u.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===d?'From':'To'} ${(0,u.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>g(s)},s)})})]}):(0,y.jsx)(m.Muted,{children:"No times left today."})}function I({rid:e,value:o,onChange:l}){const n=(0,c.usePlan)(e),[a,d]=(0,s.useState)(!!o.tables?.length);return(0,y.jsxs)(i.default,{style:{gap:6},testID:"block-scope",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"scope-all",label:"All areas",selected:!o.areaId&&!o.tables?.length&&!a,onPress:()=>{d(!1),l({})}}),n.areas.map(e=>(0,y.jsx)(m.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:o.areaId===e.id,onPress:()=>{d(!1),l({areaId:e.id,areaName:e.name})}},e.id)),(0,y.jsx)(m.Chip,{testID:"scope-tables",label:"Some tables",selected:a,onPress:()=>{d(!0),l({tables:o.tables??[]})}})]}),a?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const s=!!o.tables?.includes(e.name);return(0,y.jsx)(m.Chip,{testID:`scope-table-${e.name}`,label:(0,t.tableNumbers)(e.name),selected:s,onPress:()=>l({tables:s?(o.tables??[]).filter(t=>t!==e.name):[...o.tables??[],e.name]})},e.id)})}):null]})}function T({value:e,note:t,onChange:s,onNote:o}){return(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:r.BLOCK_REASONS.map(t=>(0,y.jsx)(m.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,y.jsx)(m.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function S({line:e,clashes:t,testID:o="block-confirm"}){return(0,s.useEffect)(()=>{j(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,y.jsxs)(i.default,{testID:o,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:b.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:b.colours.goldTint},children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,children:e}),t?(0,y.jsx)(m.T,{size:15,colour:b.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,y.jsx)(m.Muted,{children:"No bookings in this time yet."})]})}const $=e=>(0,u.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function B({rid:e,r:t,now:o,by:l,onClose:n,wide:a}){const g=(0,h.ymd)(o),p=(0,c.useDisplaySettings)(e),f=(0,u.openWindow)(t,g),k=(0,u.servicesOn)(t,g,p.serviceWindows),w=Math.max(f?.from??0,$(o)),B=(0,d.useBookings)(e),C=(0,c.usePlan)(e),[P,M]=(0,s.useState)({}),[R,L]=(0,s.useState)(!1),[W,z]=(0,s.useState)({}),[N,E]=(0,s.useState)(),[A,F]=(0,s.useState)(''),[O,_]=(0,s.useState)('pick'),[G,Y]=(0,s.useState)(''),q=!!f&&we&&e.to>w?{from:(0,h.fromMins)(Math.max(e.from,w)),to:(0,h.fromMins)(e.to)}:null,U=H(k.lunch),K=H(k.dinner),Q=q?[{id:'rest',label:'Rest of today',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(f.to)}},{id:'hour',label:'Next hour',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(Math.min(f.to,w+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!P.from&&!!P.to&&(0,h.toMins)(P.to)>(0,h.toMins)(P.from)&&!(W.tables&&!W.tables.length),J=V?(0,u.confirmLine)({dates:[g],from:P.from,to:P.to,today:g,...W}):'',X=V?(0,u.bookingsInWindow)(B,[g],P.from,P.to,W,e=>C.tables.find(t=>t.name===e)?.areaId).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:a?760:void 0,testID:"block-now-sheet",children:'done'===O?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"block-now-done",children:G}),(0,y.jsx)(m.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===O?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:J,clashes:X}),(0,y.jsx)(m.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=r.useBlocks.getState().add({rid:e,date:g,from:P.from,to:P.to,reason:N,note:A.trim()||void 0,by:l,...W});(0,x.pushBlocksToWix)(e,[t.id],'add'),Y(`Saved. ${J.replace(/^Block/,'Blocked')}.`),j(`Saved. ${J}`),_('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>_('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),q?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,y.jsx)(D,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,u.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!R&&P.label===e.id,onPress:()=>{L(!1),M({...e.w,label:e.id})}},e.id)),(0,y.jsx)(D,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:R,onPress:()=>{L(!0),M({})}})]}):(0,y.jsx)(m.T,{colour:b.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),q&&R?(0,y.jsx)(v,{min:w,max:f.to,from:P.from,to:P.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,q?(0,y.jsx)(I,{rid:e,value:W,onChange:z}):null,q?(0,y.jsx)(T,{value:N,note:A,onChange:E,onNote:F}):null,V?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"block-now-line",children:J}):null,(0,y.jsx)(m.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>_('confirm')})]})})}function C({value:e,end:t,range:o,min:l,onPick:a,testID:d="block-cal"}){const[r,c]=(0,s.useState)(()=>(e??l).slice(0,7)),g=(0,h.parseYmd)(`${r}-01`),x=(g.getDay()+6)%7,p=[...Array(x).fill(null)];for(let e=new Date(g);e.getMonth()===g.getMonth();e.setDate(e.getDate()+1))p.push((0,h.ymd)(e));const f=e=>{const t=(0,h.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,h.ymd)(t).slice(0,7))},k=s=>{if(!o||!e||t||sf(-1)}),(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:(0,u.monthLabel)(`${r}-01`)}),(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,y.jsx)(i.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,y.jsx)(m.T,{size:13,colour:b.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:p.map((s,o)=>{if(!s)return(0,y.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`e${o}`);const a=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?b.colours.gold:b.colours.surface2,borderWidth:1,borderColor:r?b.colours.gold:b.colours.border,opacity:a?.3:1},children:(0,y.jsx)(m.T,{size:17,weight:"semibold",colour:r?b.colours.onGold:b.colours.text,children:String((0,h.parseYmd)(s).getDate())})})},s)})})]})}function P({rid:e,r:t,now:o,by:l,onClose:n,wide:a,edit:g,onEdit:p}){const f=(0,h.ymd)(o),$=(0,d.useBookings)(e),B=(0,c.usePlan)(e),[P,M]=(0,s.useState)(g?.date),[R,L]=(0,s.useState)(),[W,z]=(0,s.useState)(!1),[N,E]=(0,s.useState)(g?!!g.wholeDay:null),[A,F]=(0,s.useState)(g&&!g.wholeDay?g.from:void 0),[O,_]=(0,s.useState)(g&&!g.wholeDay?g.to:void 0),[G,Y]=(0,s.useState)(g?{areaId:g.areaId,areaName:g.areaName,tables:g.tables}:{}),[q,H]=(0,s.useState)(g?.reason),[U,K]=(0,s.useState)(g?.note??''),[Q,V]=(0,s.useState)('none'),[J,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)(),[te,se]=(0,s.useState)(!1),[oe,le]=(0,s.useState)('pick'),[ne,ae]=(0,s.useState)(''),ie=P?(0,u.openWindow)(t,P):null,de=ie?.from??540,re=ie?.to??1380,ce=P?(0,h.parseYmd)(P).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=P?g?[P]:(0,u.blockDates)(P,W?R:void 0,ue,Z):[],be=N?'00:00':A,ge=N?'23:59':O,me=!!P&&he.length>0&&null!=N&&!!be&&!!ge&&(0,h.toMins)(ge)>(0,h.toMins)(be)&&('none'===Q||!!Z)&&!(G.tables&&!G.tables.length),xe=(0,u.repeatText)(ue,Z),pe=me?(0,u.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!N,today:f,repeat:xe,...G}):'',fe=me?(0,u.bookingsInWindow)($,he,be,ge,G,e=>B.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==g?.id).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:g?'Edit block':'Add a block',maxWidth:a?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"add-block-done",children:ne}),(0,y.jsx)(m.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,y.jsx)(m.Button,{testID:"add-block-save",label:g?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!N||void 0,reason:q,note:U.trim()||void 0,areaId:G.areaId,areaName:G.areaName,tables:G.tables?.length?G.tables:void 0};if(g)return p?.({...t,date:P}),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,o=r.useBlocks.getState().addMany(he.map(o=>({rid:e,date:o,by:l,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,u.longDate)(he[0])} to ${(0,u.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,x.pushBlocksToWix)(e,o.map(e=>e.id),'add'),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),j(`Saved. ${pe}`),le('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),g?null:(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"add-single",label:"One date",selected:!W,onPress:()=>{z(!1),L(void 0)}}),(0,y.jsx)(m.Chip,{testID:"add-range",label:"A range of dates",selected:W,onPress:()=>{z(!0),V('none')}})]}),(0,y.jsx)(C,{value:P,end:R,range:W&&!g,min:f,onPick:(e,t)=>{M(e),L(t)}}),P?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-dates",children:W&&R?`${(0,u.longDate)(P)} to ${(0,u.longDate)(R)}`:(0,u.longDate)(P)}):null,P?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===N,onPress:()=>E(!0)}),(0,y.jsx)(D,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ie?`Open ${(0,u.rangeText)((0,h.fromMins)(ie.from),(0,h.fromMins)(ie.to))}`:'Closed that day',selected:!1===N,onPress:()=>E(!1)})]}):null,P&&!1===N?(0,y.jsx)(v,{min:de,max:re,from:A,to:O,onChange:(e,t)=>{F(e),_(t)},testID:"add-grid"}):null,P?(0,y.jsx)(I,{rid:e,value:G,onChange:Y}):null,P?(0,y.jsx)(T,{value:q,note:U,onChange:H,onNote:K}):null,!P||g||W?null:(0,y.jsxs)(i.default,{style:{gap:6},testID:"add-repeat",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,y.jsx)(m.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,y.jsx)(m.Chip,{testID:"repeat-last",label:`Last ${k[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:w.map((e,t)=>(0,y.jsx)(m.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,h.parseYmd)(P);t.setMonth(t.getMonth()+e);const s=(0,h.ymd)(t);return(0,y.jsx)(m.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,y.jsx)(m.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,y.jsx)(C,{value:Z,min:(0,u.addDays)(P,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,y.jsx)(m.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-line",children:pe}):null,(0,y.jsx)(m.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function M({b:e,onEdit:t,onRemove:s}){const o=(0,u.whatText)(e);return(0,y.jsxs)(i.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:b.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:b.colours.surface2},accessible:!1,children:[(0,y.jsxs)(m.T,{size:17,weight:"semibold",colour:b.colours.goldLight,children:[(0,u.longDate)(e.date)," \xb7 ",(0,u.rangeText)(e.from,e.to,e.wholeDay)]}),(0,y.jsxs)(m.T,{children:[o,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.repeatText?(0,y.jsx)(m.Muted,{children:e.repeatText}):null,(0,y.jsxs)(m.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,y.jsxs)(m.Row,{gap:8,children:[(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,u.longDate)(e.date)}`,testID:`fb-edit-${e.id}`,onPress:t}),(0,y.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,u.longDate)(e.date)}`,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function R({rid:e,r:t,now:o,by:l,display:n,wide:a}){const d=(0,r.useBlocks)(e=>e.blocks),c=(0,h.ymd)(o),g=(0,u.groupByMonth)(d,e,c,(0,h.hm)(o)),k=(0,s.useMemo)(()=>(0,u.ruleRows)(t,c),[t.id,c]),[w,D]=(0,s.useState)(null),[v,I]=(0,s.useState)(null),[T,S]=(0,s.useState)(''),$=e=>e.seriesId?d.filter(t=>t.seriesId===e.seriesId&&t.date>=c):[e],B=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,u.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>r.useBlocks.getState().remove(e.id,l)),(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),void I(null);(async()=>{for(const e of t){if(!((0,f.isLive)()?await(0,p.displayBlockEdit)(e.id,'remove',{},l):{ok:!0}).ok)return void S('Could not remove it. Try again.');(0,f.isLive)()||r.useBlocks.getState().remove(e.id,l)}(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),I(null)})()},C=(t,s)=>{if(!n)return r.useBlocks.getState().update(t.id,s,l),void(0,x.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,f.isLive)()?await(0,p.displayBlockEdit)(t.id,'edit',s,l):{ok:!0}).ok?((0,f.isLive)()||r.useBlocks.getState().update(t.id,s,l),(0,x.pushBlocksToWix)(e,[t.id],'edit'),S(`Block on ${(0,u.longDate)(s.date??t.date)} changed.`)):S('Could not change it. Try again.')})()},R=[...new Set([...g.map(e=>e.month),...k.map(e=>(0,u.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,y.jsxs)(i.default,{style:{gap:12},testID:"future-blocks",children:[T?(0,y.jsx)(i.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(m.T,{colour:b.colours.goldLight,testID:"fb-msg",children:T})}):null,g.length?null:(0,y.jsx)(m.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),R.map(e=>{const t=g.find(t=>t.month===e)?.items??[],s=k.filter(t=>(0,u.monthLabel)(t.date)===e);return(0,y.jsxs)(i.default,{style:{gap:8},children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,y.jsx)(M,{b:e,onEdit:()=>D(e),onRemove:()=>I(e)},e.id)),s.map(e=>(0,y.jsxs)(i.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:b.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,y.jsxs)(m.T,{weight:"semibold",children:[(0,u.longDate)(e.date)," \xb7 ",e.name]}),(0,y.jsxs)(m.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),w?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,edit:w,onClose:()=>D(null),onEdit:e=>C(w,e)}):null,v?(0,y.jsxs)(m.Sheet,{visible:!0,onClose:()=>I(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,y.jsx)(m.T,{size:17,children:`${(0,u.longDate)(v.date)}, ${(0,u.rangeText)(v.from,v.to,v.wholeDay)}, ${(0,u.whatText)(v).toLowerCase()}.`}),(0,y.jsx)(m.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,y.jsx)(m.Button,{testID:"fb-remove-one",label:$(v).length>1?'Remove this date only':'Remove block',onPress:()=>B([v])}),$(v).length>1?(0,y.jsx)(m.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(v).length} in this series`,onPress:()=>B($(v))}):null,(0,y.jsx)(m.Button,{kind:"ghost",label:"Keep it",onPress:()=>I(null)})]}):null]})}function L({rid:e,r:t,now:o,by:l,display:n,wide:a}){const[d,r]=(0,s.useState)(null);return(0,y.jsxs)(i.default,{style:{gap:12},testID:"blocks-screen",children:[(0,y.jsx)(m.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",onPress:()=>r('now')}),(0,y.jsx)(D,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",onPress:()=>r('add')})]}),(0,y.jsx)(m.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,y.jsx)(R,{rid:e,r:t,now:o,by:l,display:n,wide:a}),'now'===d?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null,'add'===d?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null]})}function W({rid:e,r:t,now:s,by:o,onBack:n}){return(0,g.useBackLayer)(!0,n),(0,y.jsx)(l.default,{visible:!0,animationType:"fade",onRequestClose:n,children:(0,y.jsxs)(i.default,{style:{flex:1,backgroundColor:b.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,y.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(g.BackButton,{onPress:n,testID:"display-blocks-back"}),(0,y.jsx)(m.T,{size:22,weight:"semibold",colour:b.colours.gold,children:"Block bookings"}),(0,y.jsx)(i.default,{style:{width:96}})]}),(0,y.jsx)(a.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,y.jsx)(L,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1023,[808,30,118,256,263,151,127,819,824,825,1394,818,821,991,813,1395,955,820,24]);
+__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return n}}),e.isBarFridge=r,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return u}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',n=n=>'anchorage'===n||n===t;function r(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const n=t;return!!r(['name','label','kind','unit','location','storage','storageLocation'].map(t=>n[t]).filter(t=>'string'==typeof t).join(' '))||['id','key','pointId','name','label','unit','location','storage','storageLocation','aliases'].some(t=>Array.isArray(n[t])?n[t].some(r):'string'==typeof n[t]&&r(n[t]))}const o=(t,o)=>!n(t)||!r(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},u=t=>'system'===t.from&&(!!f[t.id]&&f[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1024,[]);
+__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1025,[1024]);
+__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return I}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s){const a=I(e).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),o=_(t=>!!t.server[e]),d=_((0,l.useShallow)(t=>t.events.filter(s=>s.rid===e&&(!t.server[e]||k(s))))),u=_((0,l.useShallow)(t=>w(t,e))),c=(0,f.lastUndoable)(d),v=e=>a.find(t=>t.key===e);return{items:a,events:d,counts:u,undoable:c,synced:o,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),u[e]??0),sell:(n,a=!1)=>{const o=v(n),d=o&&(0,i.fishInStone)(e,o)?i.HALF_STONE_KG:a?.5:1;return!((u[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const a=i-(u[n]??0);a&&E.append({rid:e,kind:n,delta:a,reason:'count',by:t,app:s})},undoLast:()=>{c&&E.append({rid:e,kind:c.kind,delta:-c.delta,reason:'undo',by:t,app:s,undoes:c.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),a=r(_d[4]),o=r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),v=r(_d[11]),p=r(_d[12]);const S=()=>{try{return(0,p.nowFrom)(p.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,v.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const O=[],I=(e,t=!1)=>{const s=_(t=>t.items[e])??O;return t?s:s.filter(e=>e.active).sort((e,t)=>e.sort-t.sort)},k=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const a=new Set(n.seen),o=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>k(e)&&!a.has(e.id)&&e.at>=o),s,n.counts)}},1026,[833,1132,1024,1025,5,1116,122,952,1117,873,1028,1033,872]);
+__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1027,[833,1132,5,1116,952,1117,1022]);
+__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const s={...n};for(const e of t)s[e.key]=s[e.key]??0;for(const t of e)s[t.kind]=(s[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(s).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),u=t?i(e.rid,t,Math.abs(e.delta)):s(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${u} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${u} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${u} ${n})`:`Count: ${u} ${o}`};var e=r(d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const s=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):s(o),u=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):s(o),c=(e,t)=>t<=(e?.lowAt??4)},1028,[1025]);
+__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.usePlayable=v,Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return I}}),_e.gameBase=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return I(e?.settings?.gameUrl)??j},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,m.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=v(e,s);return n?(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(u.T,{size:13,colour:c?w.colours.ok:w.colours.muted,children:c?'Open':'Opens on your break'})]}),(0,k.jsx)(u.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),(0,k.jsx)(u.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,k.jsx)(R,{staffId:e,name:t,playable:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return S}}),_e.BreakRoom=R;var t=_r(_d[0]),r=_r(_d[1]),s=e(r),n=e(_r(_d[2]));_r(_d[3]);var o=e(_r(_d[4])),l=e(_r(_d[5])),c=_r(_d[6]),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),y=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),b=_r(_d[14]),w=_r(_d[15]),k=_r(_d[16]);function v(e,t){const r=(0,f.useOwner)(e=>e.attendance);if(!e)return!0;const s=(0,f.openShiftOf)(r,e,t);return!s||(0,f.isOnBreak)(s)}const j='https://lennys-kitchen-chaos-13e285.deed.page/',I=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function x(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const S=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:v,playable:R,onClose:E}){const C=(0,f.useOwner)(e=>e.staff),T=(0,d.useAvatars)(e=>e.photos),M=(0,y.useSetup)(e=>e.looks),P=(0,r.useRef)(null),[O,L]=(0,r.useState)({}),[U,N]=(0,r.useState)(!1),[_,B]=(0,r.useState)(null),D=(0,m.useStore)(e=>I(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??j),$=(0,r.useMemo)(()=>x(D),[D]),q=$?.origin??'',A=(0,b.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),z=!(!A||!e||A===e),G=z?null:A??e??null,V=S(v),[H,W]=(0,r.useState)(''),[F,K]=(0,r.useState)(null),Y=(0,r.useRef)(null),J=(0,r.useRef)(0),Q=(0,r.useRef)(null),X=(0,r.useRef)(R);X.current=R;const Z=(0,r.useMemo)(()=>C.filter(e=>e.active&&!e.name.includes('(example)')),[C]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const t of Z){const r=document.getElementById(`cc-av-${t.id}`)?.querySelector('svg');r&&(e[t.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r.outerHTML.includes('xmlns')?r.outerHTML:r.outerHTML.replace('